Got more questions? Find advice on: ASP | SQL | XML | Regular Expressions
in Search
Welcome to WindowsAdvice Sign in | Join | Help

Steven Smith

Windows Tips and Tricks

Windows Batch File Commands

Wrote a batch file just now to do some DB setup for a Whidbey application that needs some ASP.NET features like Membership and Personalization.  So it has to call aspnet_regsql.exe a few times.  I used to write a lot of UNIX shell scripts, so I forgot what the comment character was for .bat files (hint, it wasn't '#').  In fact, it's not a character at all, but the lovely 'REM'.  Found this handy reference which includes the allowable commands:

  • @
    • Do not echo this line
  • ECHO
    • Send messages to user
    • Turn on/off output to user
  • REM
    • Comment out a line (short for remark)
  • PAUSE
    • prints "Press any key to continue..." and waits
  • GOTO
    • branches to a label
  • IF
    • can be used to check if a file exists or if a command returned an error
  • SHIFT
    • shifts command line params (useful if you have a lot of them I guess)
  • CALL
    • run another batch file from this one; allows reuse
  • FOR
    • allows looping
  • CHOICE
    • Prompts the user with a menu of choices and accepts one

Obviously I'm not offering a ton of syntax here -- go to the reference for that.

Sponsor
Published Wednesday, March 30, 2005 4:08 PM by ssmith

Comments

 

Steven Smith : Windows Batch File Commands said:

October 6, 2006 1:21 PM
 

Isoptin said:

Isoptin

qieiwrvvtlbwaqtihbzadeucelxfetaqzolzfeognkprchsbmrcmiqvfuwnzupjaalfnyebzvpuluapdslhsllrvaqtcvheksbemmzducykidpaevsyobnfjqdgebs

October 4, 2010 11:00 AM
 

TrackBack said:

. . . . . . .

October 10, 2010 2:31 AM
 

TrackBack said:

. . . . .

October 10, 2010 4:07 AM
 

cheap zaditor said:

zaditor vs patanol. zaditor vs patanol. zaditor vs patanol. cheap zaditor. cheap zaditor.

October 10, 2010 5:08 PM
Anonymous comments are disabled