Hello,
Can anybody suggest a way to replace spaces in an environment variable with "%20"? The following:
set string=%string: =%%20%
removes the spaces and appends %20%.
Thanks
Steve T.
Replace space with %20
Moderator: DosItHelp
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Code: Select all
@echo off
setlocal enabledelayedexpansion
set "string=string with a space"
set string=!string: =%%20!
echo %string%