Running start in a batch file or .cmd file displays a command prompt instead of running the application.
I've recently run into an issue whereby I'm trying to start several Visual Studio environments as another user with the runas command for remote testing.
So I created a batch file with the runas command which then launches a second batch file that starts 4 instances of Visual Studio.
@echo off
cls
start "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
However instead 4 command prompt windows are loaded.
When you run the same command live inside a command prompt it works.
This is a case of not reading the documentation! The first parameter of the start command is the window title, so you need two double quotes, or just enter any title.
@echo off
cls
start "" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
So I created a batch file with the runas command which then launches a second batch file that starts 4 instances of Visual Studio.
@echo off
cls
start "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
However instead 4 command prompt windows are loaded.
When you run the same command live inside a command prompt it works.
This is a case of not reading the documentation! The first parameter of the start command is the window title, so you need two double quotes, or just enter any title.
@echo off
cls
start "" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
start "" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
Comments
Post a Comment