I am writing a custom pluggable protocol handler, which is basically the following batch script:
@ECHO off
SET "FullPath=%~1"
explorer.exe "%FullPath%"
However if Windows Explorer passes a UNC with spaces it comes to the script with %20 instead of space:
\Groups\Group%20Micro\
instead of
\Groups\Group Micro\
Can you help me to figure out a batch script snippet replacing "%20" to " " or "\ " in the string please?
So far I found Replace Percent with Bang in String, but it requires somehow to replace % with %%, which is a separate task.
Thank you very much.
Eventually many thanks to Windows batch script url decoding I worked out desired snippet:
@ECHO off
SET "FullPath=%~1"
REM ECHO %FullPath% & PAUSE
SETLOCAL ENABLEDELAYEDEXPANSION
SET FullPath=%FullPath:smb:=%
SET FullPath=%FullPath:/=\%
SET FullPath=!FullPath:%%20= !
REM ECHO %FullPath% & PAUSE
explorer.exe "%FullPath%"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With