ZTree.com  | ZEN  | About...  

 Index   Back

[Q] batch anomalies related with SID and >> operator   [Q]

By: Ryan       
Date: Sep 17,2017 at 06:29


anomaly 1
AA=
@ECHO OFF
SET SID1=WMIC useraccount where name="%%USERNAME%%" get sid
ECHO %SID1%
FOR /F "DELIMS=" %%%V IN ('"%SID1%"') DO SET SID2=%%%V
ECHO %SID2%
PAUSE


AA= works in XP, but it doesnt work in 8.1 and probably not in win10.
so if your variable is the same as the SID (secret identifier), does these NEW OS's reject the variable?

--------------------------------------
anomaly 2

@ECHO OFF
SET OUT=M:\!AA.TXT

FOR /F "TOKENS=1 DELIMS= " %%%K IN ("1 23") DO SET D1=%%%K
FOR /F "TOKENS=2 DELIMS= " %%%K IN ("1 23") DO SET D2=%%%K

ECHO works %D1%
ECHO works %D2%

ECHO doesnt work=%D1%>>%OUT%
ECHO works but with a space at the end=%D1% >>%OUT%
ECHO works=%D2%>>%OUT%
PAUSE

why doesnt ECHO %D1%>>%OUT% work? this is odd to me. if it is one letter, does OS refuse it to write it?

376 views      
Thread locked
 

Messages in this Thread

 
94,650 Postings in 11,937 Threads, 348 registered users, 16 users online (0 registered, 16 guests)
Index | Admin contact |   Forum Time: Dec 9, 2019 - 7:39 pm EST  |  Hits:29,384,198  (3,033 Today )
RSS Feed