batch file for command parsing path -


i trying read file path windows batch file variable

set print_nodepath=reg query "hklm\software\node.js" /v installpath /f "skip=2 tokens=3" %%a in ('%print_nodepath%') set nodepath=%%a echo %nodepath% 

the reg query correctly returns

hkey_local_machine\software\node.js  installpath    reg_sz    c:\program files\nodejs\ 

but don't know how write 'for' command grab file path since contains space (c:\program). suppose need join 3rd , 4th tokens?

is there "good" way write this?

you need few modification:

  • change tokens=3 tokens=2*;
  • read variable %%b rather %%a;

here fixed code:

set print_nodepath=reg query "hklm\software\node.js" /v installpath /f "skip=2 tokens=2*" %%a in ('%print_nodepath%') set "nodepath=%%b" echo(%nodepath% 

this works if registry value name not contain white-spaces on own.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -