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,068 of 42,547   
   Nick to foxidrive   
   Re: [MSDOS7] if ".echo off"==".echo off"   
   30 Dec 14 12:51:48   
   
   From: nickoffsmailbox@gmail.com   
      
   On Thursday, 25 December 2014 19:36:32 UTC+8, foxidrive  wrote:   
   > On 25/12/2014 07:07, Nick wrote:   
   >   
   > > -Do you need to test if Windows 95 is running to branch elsewhere in your   
   code?   
   > >   
   > > It's actually an exercise in almost the opposite; trying to make a simple   
   > > "Windows neutral" batch file as compatible as reasonably possible with   
   > > both 9x and NT based systems without bogging it down with unnecessary OS   
   > > checks, and potentially limiting or flawed assumptions based on such   
   checks.   
   >   
   >   
   > > -What do you actually need to do?   
   > >   
   > > What I'm wanting to do with the code I posted is to test if 'SET' handle   
   the /P   
   > > switch, i.e. is able to create a variable, and assign a users input as it's   
   > > value.   
   >   
   > > @echo off   
   > > set /p=anul   
   > > if .%/p%==a. echo D'oh!   
   >   
   > I retyped that and made an error - the period is on the wrong side of the a   
   > This is correct I think (but isn't a copy and paste - the VM broke the   
   bidirectional clipboard)   
   >   
   > @echo off   
   > set /p=anul   
   > if .%/p%==.a echo D'oh!   
      
      
   Neat!   
      
   Your workaround is of course far more practical and succinct than the one I was   
   thinking to use (if "/p inputcmd"=="promp string"). Thanks.   
      
   For what it's worth I did grind out a solution of sorts. It's hardly pretty,   
   and probably old news to the old hands, but it works here and in any case was   
   an enlightening way to learn that "echo off" isn't the only answer in w9x to   
   "what's long and hard and screws bats?"   
      
   ::a b c   
   @echo off   
   set >nul <%0 /p i.e.=d'oh...   
   if not "Windows_NT goto :w9x ::a b c"=="%OS% goto :w9x %i.e.%" goto :nt4   
   echo %i.e.::=%   
      
   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