Notice the lines in this output example like "The system cannot find the file 쭀ŷ♣☼ŔЈ ":
Code: Select all
C:\>FOR /F "tokens=*" %A IN (" ?/cmd: "shUser=user1"; "shPrivs=none"") DO SET tmpLn=%A
C:\>SET tmpLn=?/cmd: "shUser user1"; "shPrivs none"
The system cannot find the file Ѐ♫♫ѠǨ§鿠Ś.
C:\>FOR /F "tokens=*" %A IN (" ?/cmd: "shUser=user1"; "shPrivs=none"") DO SET tmpLn=%A
C:\>SET tmpLn=?/cmd: "shUser user1"; "shPrivs none"
The system cannot find the file Ѐ ♫.
C:\>FOR /F "tokens=*" %A IN (" ?/cmd: "shUser=user1"; "shPrivs=none"") DO SET tmpLn=%A
C:\>SET tmpLn=?/cmd: "shUser user1"; "shPrivs none"
The system cannot find the file Ј*♫8Хˈ§逈ƈrrLevel!.
C:\>set tmpLn
tmpLn=?/cmd: "shUser user1"; "shPrivs none"
the string in the FOR loop is padded with an unknown number of [tabs] and [spaces] at the beginning and sometimes at the end. The code above is my attempt to TRIM this whitespace. Now the code actually works fine even though it throws an error - notice that the [tmpLn] variable gets set properly.
I just can't figure out why it throws these errors on SOME lines - most are fine. Every line with an error begins with some [whitespace][?/text]. And every error throws different gibberish (i.e. cannot find the file ƈE]) - usually .
Any thoughts ?