Double quotes should be usually used around entire folder/file string and not just parts of it.
Command START interprets first double quoted string as title for the new command process. Therefore on starting a GUI application an empty title string specified with ""
should be used on START command line to avoid interpreting the double quoted file name with path of the application to execute as title string.
The batch file path referenced with %~dp0
always ends with a backslash. Therefore don't specify an extra backspace after this string or an environment variable like runningDir
with path of batch file. By the way: The current directory on running a batch file can be different to directory of batch file. For that reason the name runningDir
is not good as misleading. A better name for the environment variable is BatchPath
.
It is possible to use start
as label in a batch file. But it is not advisable to do that because of command START which makes it difficult to search for label respectively search for command. It is better to use a label like Begin
.
In an url the directory separator is /
and therefore each backslash (directory separator on Windows) in batch file path should be substituted by a slash.
The url should start with the protocol like http://
(Hypertext Transfer Protocol) and should be enclosed completely in double quotes.
And last echo/
or echo(
is better than echo.
for printing a blank line, see Difference between Echo[Special Character] for details.
The rewritten batch code:
@echo off
echo/
set "BatchPath=%~dp0"
set "BatchPath=%BatchPath:\=/%"
:Begin
clS
echo/
set /P "Job=Enter number: "
if exist "%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe" goto program_files_x86
:program_files_x86
start "" "%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe" --disable-print-preview --ignore-certificate-errors --disable-web-security --user-data-dir --allow-file-access-from-files "http://%BatchPath%order.htm?order=%Job%"
goto end
:end
goto Begin
For understanding the used commands and how they work, open a command prompt window, execute there the following commands, and read entirely all help pages displayed for each command very carefully.
cls /?
echo /?
goto /?
if /?
set /?
start /?