ZTree.com  | ZEN  | About...  

 Index   Back

i think i found the anomaly, looks like an XP's bug   [Q]

By: Ryan       
Date: Sep 20,2017 at 02:38
In Response to: it is not quite so, still not working, still suspicious. (Nick Williams)

> OK, I would rather not start WMIC on the computer I'm using, so I
> can't follow you directly,

yes complete backup , restore doesnt really work when you need it, registry editing done by an external or internal command through cmd. it will not go back to the so and so past state of time.

echo WMIC strings alone is ok
as long as you dont use what you found in WMIC's %OUT% liek below

set out1=[-registry key that you find from SID and strings]
regedit /s %OUT1%
this could kill the OS in a sec.

i think i found the anomaly
i think it is an XP's bug and not a new OS's problem

WMIC useraccount where name="%USERNAME%" get sid
makes 3 lines below, but the 3rd line was a null string.
SID
S-1-5-21-1200038644-3393777314-17737942256-500
(null string)

XP treats a null string not as an input so SID2 takes the final value as
S-1-5-21-1200038644-3393777314-17737942256-500

on the other hand,
win8.1 or win10 takes the null string as an input value as well, so they take the 3rd value as a final, i think i have to read 1 variable by 1 variable from FOR /F loop to take the 2nd one that both XP and new OS's agree on

this kind of subtlety is too much

thanks for a help, talking about it made me investigate deeper.







but there's an undocumented trick you can
> try. In AA=, in the "FOR /F" line, add an "@" symbol, as follows:-
>
> FOR /F "DELIMS=" %%V IN ('@"%SID1%"') DO SET SID2=%%V
>
> Does that help ? (I can't test this for you, but it will either work
> or not)
>
> > BB=
> > ECHO ON
> > (ECHO:1)>>m:\aa.txt works
> > (ECHO:11)>>m:\aa.txt works
> >
> > ECHO 1>>m:\aa.txt doesnt work
> > ECHO 11>>m:\aa.txt works
> > ECHO a>>m:\aa.txt works
> > ECHO ab>>m:\aa.txt works
> >
> > i think it doesnt like one number, there must be something special
> > about this 1>> or 2>>....
>
> Yes, the number is definitely special in this situation ! It designates
> which "stream" your redirected output is going to. The standard streams
> are as follows:-
>
> STDIN : Standard Input (usually the keyboard) has the number 0
> STDOUT : Standard Out (usually the monitor) has the number 1
> STDERR : Standard Error (similar to STDOUT, but for errors) has the
> number 2
>
> The default stream (when no number has been specified) is STDOUT. So,
> if you wanted to redirect STDOUT to your file, you could code:-
>
> ECHO:Hello world! >%OUT%
>
> -or-
>
> ECHO:Hello world! 1>%OUT%
>
> So, going back to your BB= example:-
>
> > ECHO 1>>m:\aa.txt doesnt work
>
> You must use parentheses to resolve the ambiguity, as follows:-
>
> (ECHO 1) >>m:\aa.txt
>
> > if somehow i start to use more parenthesis like this (ECHO:%HH%) in
> > nested loops, which i am already having a trouble with, OS might
> > interpret them wrongly.
>
> On the contrary, the OS will respect any number of parentheses, nested
> or not -- as long as they are correctly balanced. It will also make your
> code much easier to read and manage.
>
> > i have to import a lot of [-HKEY_CURREN...] to delete the registries
> > before i write the new ones, yes it is a very dangerous operation.
>
> Yes, it does sound dangerous -- hope you've got good backups !

338 views      
Thread locked
 

Messages in this Thread

 
94,424 Postings in 11,918 Threads, 348 registered users, 8 users online (1 registered, 7 guests)
Index | Admin contact |   Forum Time: Sep 16, 2019 - 8:19 am EDT  |  Hits:28,642,952  (625 Today )
RSS Feed