home bbs files messages ]

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

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

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

   Message 67,176 of 68,980   
   B00ze to Paul Emmons   
   Re: Side effect of SETLOCAL   
   11 Apr 18 22:48:04   
   
   From: B00ze64@hotmail.com   
      
   On 2018-04-11 19:19, Paul Emmons  wrote:   
      
   > Consider this short demonstration batch file (running under Win7):   
   > setlocal   
   > Z:   
   > cd \TEMP   
   > dir   
   >   
   > The dir command lists the files of Z:\temp, proving that this is   
   > indeed the current directory of Z: at the time.   
   >   
   > However, after termination, the current directory of Z: reverts   
   > to whatever it was before execution.  Furthermore, if before   
   > execution the current drive and directory per the command prompt   
   > are for another drive, e.g. C:\, this situation is also restored.   
   >   
   > Without setlocal, the current directory will remain Z:\TEMP.   
   >   
   > Maybe this behavior is common knowledge to everyone here, but the   
   > help for SETLOCAL does not mention it.   
      
   Ah! I didn't know this! And me going PUSHD/POPD to be nice to people,   
   there is no need! :-)   
      
   Thanks!   
   Best Regards,   
      
   --   
   ! _\|/_  Sylvain / B00ze64@hotmail.com   
   ! (o o)   Member:David-Suzuki-Fdn/EFF/Red+Cross/SPCA/Planetary-Society   
   oO-( )-Oo  WORK HARDER!... Millions on welfare depend on you!   
      
   --- 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