home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 41,057 of 42,547   
   Nick to All   
   [MSDOS7] if ".echo off"==".echo off" res   
   23 Dec 14 23:57:48   
   
   From: nickoffsmailbox@gmail.com   
      
   Hello. I had planned to use the following 'SET /P' check in a batch file I   
   intend to be used on both 9x and NT systems until I tested it on Windows   
   98SE (a Windows Virtual PC VM running on Windows 7 x64 should it matter)   
   and it failed with a 'Bad command or file name' error.   
      
   @ECHO OFF   
   SET INPUTCMD=   
   ...   
   SET >nul <%0 /P INPUTCMD=Test if SET waits for input   
   CLS   
   IF NOT ".%INPUTCMD%"==".@ECHO OFF" GOTO:NEXTTEST   
      
   I worked out it was tripping up on the string compare, that it would fail   
   if any part of either string included "ECHO OFF" or "ECHO ON".   
      
   Two questions spring from that. First, can anyone suggest an alternate way   
   of testing for SET /P besides the obvious solution (ensuring something   
   other than ECHO OFF|ON is on the first line of the batch file) and second,   
   are there any other string MSDOS 7.x is known to choke on in a similar   
   manner?   
      
   Cheers, Nick.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca