Shared INI and Dir Hotlist

English support forum

Moderators: Hacker, petermad, Stefan2, white

User avatar
Dalai
Power Member
Power Member
Posts: 10036
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

MVV wrote:Oops, I've posted debug version, it should be 3* and not 2* in a batch.
That still doesn't work. Although this works correctly for parameters with spaces, there's no 4th token if the parameter consists of one word only (like Desktop), so the result of the for-loop is empty.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

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.
Post Reply