Yes, you're right, space in parameter name is a trouble, and batch should count spaces in it.
Or a replacing bunches of spaces with unique delimiter - it is better than replacing exact type name with spaces (types may vary). Finally I've added another
for:
Code: Select all
@echo off
if -%1==- echo User Shell Folders value name should be passed. & pause & goto :EOF
set $PATH=
for /f "usebackq delims=" %%p in (`reg.exe query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "%~1" ^| find /i "%~1"`) do set "$PATH=%%p"
for /f "tokens=4 delims=*" %%p in ("$PATH=%$PATH: =*%") do set "$PATH=%%p"
%COMMANDER_EXE% /O /S /L="%$PATH%"
First one only extracts entire value descriptor to a variable and then second one extracts path from it after replacing every 4-space delimiter with
*.
Stefan2 wrote:Clever one '[face=timesnewroman]&& set t=[/face]'
It isn't required to double ampersands, one if enough to chain commands.