1.

Solve : are batch file writing different in windows xp and dos 7.1?

Answer»

when i run this BAT file in windows command prompt it works fine when i run it from dos 7.1 prompt i get syntex errors
anyone know why?
thanks
Code: [Select]echo off



:start
cls
echo Input password:

IF %DATE:~0,3%==Mon goto mond
IF %DATE:~0,3%==Tue goto tues
IF %DATE:~0,3%==Wed goto wedd
IF %DATE:~0,3%==Thu goto thur
IF %DATE:~0,3%==Fri goto frid
IF %DATE:~0,3%==Sat goto sate
IF %DATE:~0,3%==Sun goto sund


Quote from: flyhigh427 on June 24, 2010, 02:17:49 AM

when i run this bat file in windows command prompt it works fine when i run it from dos 7.1 prompt i get syntex errors
anyone know why?

Because it uses the NT command extensions, namely, those allowing string manipulation.is there a way for a batch file to tell the difference between windows command and older dos versions?
yes, in your batch script, you make a MANUAL effort to check the operating system the batch file is on. EG using ver etc.
But i will tell you a BETTER way to do things. Use a PROGRAMMING language like Perl or Python (or vbscript if you are a native guy) to do your scripting stuffs. Their syntax seldom change (much) across different platforms and software version.


Discussion

No Comment Found