I'm trying to create a simple script in batch to run in Windows, the script has 3 variables:
- the URL to open
- the number of windows to open
- the time to wait until the new window is open
The script works fine except when the URL contains characters like %20 or %2F in which I guess cmd.exe is trying to use them as variables, I'm putting the value of the URL between quotes but that didn't help.
If I use the address:
set url="http://domain.com/app.html?path=%2F%2Flocalhost%2Fcode&do_pause=false&go=true"
the browser opens this:
https://domain.com/app.html?path=FFlocalhostFcode&do_pause=false&go=true
Is there a way I can set the variable or process its value so it does not interpret these symbols as variable names?
Thanks in advance, here is the code for reference. It is the first time I've tried to program a script in batch so any suggestion would be really appreciated.
@echo off
echo "Setting variables..."
set iterations=2
set url="http://domain.com/app.html?path=%2F%2Flocalhost%2Fcode&do_pause=false&go=true"
set time=5
set browser="C:\Program Files\Google\Chrome\Application\chrome.exe"
echo "Running the browser..."
FOR /L %%i IN (1,1,%iterations%) DO (
%browser% %url%
timeout %time%
)
ECHO Browsers are running, press Enter when ready to close this window. . .
pause