1.

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

Answer» <html><body><p>when i run this <a href="https://interviewquestions.tuteehub.com/tag/bat-394554" style="font-weight:bold;" target="_blank" title="Click to know more about BAT">BAT</a> file in windows command prompt it works fine when i run it from dos 7.1 prompt i get syntex errors<br/>anyone know why?<br/>thanks<br/> Code: <a>[Select]</a>echo off<br/><br/><br/><br/>:start<br/>cls<br/>echo Input password:<br/><br/>IF %DATE:~0,3%==Mon goto mond<br/>IF %DATE:~0,3%==Tue goto tues<br/>IF %DATE:~0,3%==Wed goto wedd<br/>IF %DATE:~0,3%==Thu goto thur<br/>IF %DATE:~0,3%==Fri goto frid<br/>IF %DATE:~0,3%==Sat goto sate<br/>IF %DATE:~0,3%==Sun goto sund<br/><br/><br/> Quote from: flyhigh427 on June 24, 2010, 02:17:49 AM</p><blockquote>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<br/>anyone know why?<br/></blockquote> <br/>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?<br/>yes, in your batch script, you make a <a href="https://interviewquestions.tuteehub.com/tag/manual-247374" style="font-weight:bold;" target="_blank" title="Click to know more about MANUAL">MANUAL</a> effort to check the operating system the batch file is on. <a href="https://interviewquestions.tuteehub.com/tag/eg-445433" style="font-weight:bold;" target="_blank" title="Click to know more about EG">EG</a> using ver etc.<br/>But i will tell you a <a href="https://interviewquestions.tuteehub.com/tag/better-895998" style="font-weight:bold;" target="_blank" title="Click to know more about BETTER">BETTER</a> way to do things. Use a <a href="https://interviewquestions.tuteehub.com/tag/programming-1806" style="font-weight:bold;" target="_blank" title="Click to know more about PROGRAMMING">PROGRAMMING</a> 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.</body></html>


Discussion

No Comment Found