please dont rip this site

Conditional symboles on Windows NT/XP command lines and the compatibility issues they cause

CONDITIONAL PROCESSING SYMBOLS

Conditional processing symbols allow you to control the execution of commands; allowing you to issue multiple commands from the same prompt and to govern program flow based on the results of a command. Using these in special ways allow you to extend the command prompt rules. These symbols may not be part of a file name. Note that filenames and extensions can be up to 256 characters long under Windows NT/2000/XP.

The conditional processing symbols are: " * : / \ ? < >

For a complete description of conditional symbols, use the system Help (Help and Support under Windows XP) using keyword: conditional. Extensions of the command processor, CMD.EXE over COMMAND.COM are described under Help and Support keyword: CMD. General commands are described under Help and Support keyword: commands. Under Windows XP after doing this, click the "Full text search matches" bar at the bottom of the results screen.

Conditional processing symbols

&
The ampersand (&) separates multiple commands on one command line.
( )
The parentheses groups multiple commands. See FOR
; ,
The semicolon or comma (; ,) separate command parameters.
^
The caret (^) allows you to use a command symbol as text (ignores the symbols special meaning).
&&
The double ampersand (&&) causes the command following this symbol to run only if command preceding symbol is successful. Under some circumstances (issue HELP CMD from NT DOS Prompt) this double Ampersand must be put in double-quotes.
||
The double pipe (||) causes the command following this symbol to run only if command preceding symbol fails. Also: IF ERRORLEVEL
%
The percent (%) sign is often used to designate batch file argument number; under Windows NT/2000/XP just use percent sign for this. To type a percent sign, use two percent signs; e.g., Echo 10%% would output 10%.

Examples

Therefore under Windows NT/2000/XP Command Prompt, the rules are slightly different than under Windows 9x or DOS. For example, one of these differences is that an Ampersand (&) is a special character under NT/2000/XP Command Prompt (or START/RUN) command lines. In particular, & is used to separate commands and so cannot simply appear as an option to a command.

For example, the command:
PKZIP -a -ex -& a:\Zipfile.zip c:\FilesToZip
works under all Windows 9x MS-DOS Prompt (or START/RUN) but would fail under Windows NT/2000/XP Command Prompt; in the latter case, preceed it with a caret (^). For example:
PKZIP -a -ex -^& a:\Zipfile.zip C:\FilesToZip
When writing Batch files this must be taken into consideration.

For example, to run the above DOS PKZIP command via a .BAT file that will run under Windows NT/2000/XP Command Prompt or any other Windows DOS (prompt), one could write the DOS Batch file:

@Echo off
REM Environment variable OS is set for Windows NT.
if NOT "%OS%" == "Windows_NT" GoTo NotNT
  Echo this is Windows NT
  PKZIP -a -ex -^& a:\ZipFile.ZIP C:\FilesToZip
  GoTo Next
:NotNT
  Echo this is NOT Windows NT
  PKZIP -a -ex -& a:\ZipFile.ZIP C:\FilesToZip

file: /Techref/os/win/winnt/consym.htm, 3KB, , updated: 2005/8/24 09:55, local time: 2024/12/26 07:17,
TOP NEW HELP FIND: 
18.119.124.204:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/Techref/os/win/winnt/consym.htm"> Conditional symboles and the compatibility issues they cause</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?