Hello! another brain breaker for me! i am trying to change some key values through scripting. the thing is the path needs to have a wildcard in it. the real path is: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001\Ndi\Params\*FlowControl keyname = Default type = REG_SZ data 3 Basicly i would like to change the data (is 3 now) to 0 , where {4d36e972-e325-11ce-bfc1-08002be10318} is the wildcard, so can be changed with every value. i have tried many things, like Code: FOR /F "tokens=8 delims=-" %G IN ('reg query HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class" ^| find "*FlowControl" ^| find /v "Default"') DO reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\%G\0000\Ndi\Params\*FlowControl /v Default /t REG_SZ /d 0 /f but it gives the error "G\0000\Ndi\Params\*FlowControl was unexpected at this time." Does anyone have a clue what I am doing wrong here ? ive been trying for about 2hrs now, and i am really lost.
Ain`t your script misses one double quote at the beginning of registry path HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class? Corrected one Code: FOR /F "tokens=8 delims=-" %G IN ('reg query "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class" ^| find "*FlowControl" ^| find /v "Default"') DO reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\%G\0000\Ndi\Params\*FlowControl /v Default /t REG_SZ /d 0 /f
Thanks for the reply. It doesnt give any error this time, although it stays at its value 3 after i refresh in regedit. could it be it is protected because the folder if you call it that has a * in its name ? *Flowcontrol
You can debug your script just by echoing the results on the screen Code: FOR /F "tokens=8 delims=-" %%G IN ('reg query "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class" ^| find "*FlowControl" ^| find /v "Default"') DO echo '%%G' As for protection, you can check the security properties in regedit.
I really dont know. It was in one of the examples i picked up from the net. removing it , so its just | gives the same result btw. I have also tried with just %g instead of %%g.
When you use FOR from command line you should use "%G", when in script - "%%G". And the '^' is used to escape the pipeline '|' in commands written in the string inside the IN. I have tried reg query "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class" and it returns only GUIDs. PS If you are trying to get registry values under all registry keys there, then you should find proper command.
the problem is the key is "default" under a subfolder (*FlowControl*). if i search for default, all gui's will be named. thats why i needed a wildcard to search for the *flowcontrol folder and look for a key called Default in there.
You will not find subkeys of values by reg query "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class" It will list all keys under the "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class". Btw, you can use short form "HKLM" instead of "HKEY_LOCAL_MACHINE".
oh well i will try again tomorrow. this thing made me really tired lol thanks for the help and explanations so far though!
You can list all keys and subkeys and values with this command reg query "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class" /s
And another "btw" - we can do it in PowerShell script. (Whatever we want, PowerShell is at our service!)