Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command shell parsing problem

Status
Not open for further replies.

DrNeko

Technical User
Jul 3, 2008
1
US
The Windows environment has apparently been set up differently on Windows 2000 than on Windows 2003 R2 64-bit Edition, such that command line parsing follows different rules when the Windows command shell interprets bat file statements.

To illustrate this problem, try this sample bat file (copy and paste it into your own bat file, on various different PCs). Call it whatever name you want. For the purposes of this illustration, I am calling it xyz.bat, but you can call it anything.

ECHO ON
ECHO !!!! in Tldrbat.bat !!!
ECHO !!! CMDEXTVERSION IS %CMDEXTVERSION% !!!!
if /i "%1" EQU "FSIRC" (
echo IN 1a
set Op1=
set FSIRCOp="FSIRC=
)
pause waiting - got past first test OK.


Now, once you have copied/pasted/saved this bat file, try running it as follows.
First cd to the folder that contains your bat file, and enter the following command exactly as follows
xyz "a=b"

If you run it on Windows 2000, here is what you will see, indicating that the processing made it throught the "if /i" statement OK:
C:\TEMP>pause waiting - got past first test OK.
Press any key to continue . . .

at which point just hit Enter and the bat file will terminate.

But if you do the same thing on Windows 2003, here is the console response:
=b"" was unexpected at this time.
and control immediately exits the bat file, never getting to execute the pause statement.

Is there anyway to have Windows 2003 parse in the same manner as in Windows 2000? Is there anyway around this problem? Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top