Batch script windows console

Creation: 27 juillet 2006
Mise à jour: 13 octobre 2006
Version: 1.1
Author: Jean-Louis Bicquelet-Salaün
Location: http://jlbicquelet.free.fr
Copyright: (c) 2006 Jean-Louis BICQUELET-SALAÜN

 

I finally translated into English!

For more information about thet faq, please contact Jean-Louis BICQUELET


FAQ Revised: Monday 11 September 2006 11:27:35


Table of Contents

1. for
2. syntax
3. tip
4. network
5. account

1. for

1.1. How can I display the subdirectories of a directory ?
dir |awk '{print $4}' > d:\tmp\liste.txt
for /f %i in ( d:\tmp\liste.txt ) do dir %i



2. syntax

2.1. How can I manipulate a variable ?
set nom=toto
echo %nom%


2.2. How can I get the date ?
set a=%date%
ECHO. todays date is %a%



3. tip

3.1. How can suppres command output ?
Redirect display into nul
ipconfig >nul


3.2. How can I create a file named toto with a 0 size?
type nul > toto



4. network

4.1. How can I find th IP adress of my machine ?
This tip works on both language (english and french).
 C:\>ipconfig |find "IP"
Configuration IP de Windows
        Adresse IP. . . . . . . . .á. . . : 192.168.197.27


4.2. How can I display mounted filesystems ?
d:\>net use
Les nouvelles connexions ne seront pas mémorisées.


État         Local     Distant                   Réseau

-------------------------------------------------------------------------------
             G:        \\BATMAN75\APPLICATIONS\SYSTEME
                                                 NetWare Services
             V:        \\BATMAN75\COMMUN          NetWare Services
 La commande s'est terminée correctement.


4.3. How can I mount a filesystem accross the network from the command line?
V:\>net use y: \\prod0069\partage
Le mot de passe ou nom d'utilisateur n'est pas valide pour \\prod0069\partage.

Entrez le nom d'utilisateur de 'prod0069': xprod
Entrez le mot de passe de prod0069 :
La commande s'est terminée correctement.



5. account

5.1. How can I display my account caracteristics?
C:\>net  accounts
Fermeture forcée de la session après expiration ? :            Jamais
Durée de vie minimale du mot de passe (jours) :                0
Durée de vie maximale du mot de passe (jours) :                42
Longueur minimale du mot de passe :                            0
Nombre de mots de passe antérieurs à conserver :               Aucune
Seuil de verrouillage :                                        Jamais
Durée du verrouillage (min) :                                  30
Fenêtre d'observation du verrouillage (min) :                  30
Rôle de l'ordinateur :                                         STATION
La commande s'est terminée correctement.



Copyright (c) 2006 Jean-Louis BICQUELET

This list of questions and answers was generated by makefaq.