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 68,033 of 68,980   
   JJ to John Stockton   
   Re: Set an environment variable YWD to c   
   12 Apr 23 08:50:11   
   
   From: jj4public@outlook.com   
      
   On Tue, 11 Apr 2023 15:16:54 -0700 (PDT), John Stockton wrote:   
   >   
   > But it must be nicer to do it in pure Batch - how?   
      
   Are those character code numbers in hexadecimal or in decimal?   
      
   If they're in hexadecimal, it'd be easy:   
      
   set YWD= !"#$%&'()   
      
   However, if they're hexadecimal, i.e. decimal control code 20 to 29; then I   
   think it's not possible using pure batch, since the control code 26 is for   
   EOF.   
      
   At command prompt, EOF is treated as input terminator or end of input, and   
   any following characters are ignored. e.g. below command line displays "abc"   
   and doesn't cause any error due to syntax error because of the missing   
   command after the pipe character. Note: the `^Z` is the EOF character   
   emittable from the command prompt using CTRL+Z. It's not a 2-characters   
   literal string.   
      
   echo abc^Zxyz |   
      
   In batch file, EOF is treated as a line separator or a command line   
   separator. e.g. below code displays "abc" and "xyz" in separate lines.   
      
   echo abc^Zecho xyz   
      
   > I can set an environment variable YWD to characters 20-29 of a one-line   
   > file, ending CRLF, using an ancient utility COLS, written by me.   
      
   If your COLS tool use `SetEnvironmentVariable` Windows API function, you're   
   only setting an environment variable which belong to that tool's process. It   
   won't affect the environment variable of the batch file (the CMD process)   
   where that tool is executed from. Meaning that, the batch file won't have   
   the YWD variable added. It would require `WriteProcessMemory` function to   
   modify environment variables of other process, and it's not a trivial thing   
   to achieve.   
      
   --- 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