Как запустить программу с аргументами командной строки на Windows ‘cmd с командой’ start’?

Availability

Start is an internal command that is available in the following Microsoft operating systems.

Errorlevels

If the command is successfully started ERRORLEVEL =unchanged, typically this will be 0 but if a previous command set an errorlevel, that will be preserved (this is a bug).
If the command fails to start then ERRORLEVEL = 9059
START /WAIT batch_file – will return the ERRORLEVEL specified by EXIT

Examples

Run a minimised Login script: START “My Login Script” /Min Login.cmd

Start a program and wait for it to complete before continuing: START “” /wait autocad.exe

Open a file with a particular program:START “” “C:Program FilesMicrosoft OfficeWinword.exe” “D:Docsdemo.txt”

Open Windows Explorer and list the files in the current folder (.) :C:anyolddirectory> START .

Run a program

To start a new program (not a batch script), you don’t have to use CALL or START, just enter the path/file to be executed, either on the command line or within a batch script. This will behave as follows:

Start examples

start notepad myfile.txt

Start a new instance of Notepad with the file myfile.txt.  

start /MAX notepad

Start the notepad window with the screen maximized.

start /MIN mybatch.bat

The above example would start the batch file mybatch.bat in a minimized window.

start c:music"my song.mp3"

If the file or folder has a space in it, you must surround it with quotes. In the above example, we’re starting the MP3 song file “my song.mp3”. Without the quotes surrounding the file name with a space, you would get a Windows cannot find the file error.

Windows xp and earlier syntax

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/WAIT] [/B] [command/program] [parameters]

If Command Extensions are enabled, external command invocation through the command line or the START command changes as follows:

:/>  «Просмотрите интеллектуальный диск и получите представление о проверке информации« SMART »на вашем жестком диске Windows 10 на наличие потенциальных проблем»

non-executable files may be invoked through their file association by typing the name of the file as a command. (e.g., WORD.DOC would launch the application associated with the .DOC file extension). See the ASSOC and FTYPE commands for how to create these associations from within a command script.

When executing an application that is a 32-bit GUI application, CMD.EXE does not wait for the application to terminate before returning to the command prompt. This new behavior does NOT occur if executing in a command script.

When executing a command line whose first token is the string “CMD ” without an extension or path qualifier, then “CMD” is replaced with the value of the COMSPEC variable. This change prevents picking up CMD.EXE from the current directory.

When executing a command line whose first token does NOT contain an extension, CMD.EXE uses the value of the PATHEXT environment variable to determine the extension. The default value for the PATHEXT variable is:

Как запустить программу с аргументами командной строки на windows ‘cmd с командой’ start’?

start /b "" "c:Program FilesOracleVirtualBoxVBoxHeadless.exe" -startvm "debian604 64"

если Вы читаете список параметров с start /?:

START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B] [command/program] [parameters] "title" Title to display in window title bar. command/program If it is an internal cmd command or a batch file then the command processor is run with the /K switch to cmd.exe. This means that the window will remain after the command has been run. If it is not an internal cmd command or batch file then it is a program and will run as either a windowed application or a console application. parameters These are the parameters passed to the command/program.

ожидается title заключены в кавычки ("). Так как ваш путь программы включал кавычки, он интерпретировался как заголовок. Добавление явного заголовка (в данном случае пустого,"") работает.

:/>  Установка и настройка Firewalld — все, что нужно знать

альтернативный метод использует /d переключатель для указания пути. Конкретно:

start /b /d "c:Program FilesOracleVirtualBox" VBoxHeadless.exe -startvm "debian604 64"

его первый аргумент после /d переключитесь как путь, даже если он заключен в кавычки, и если следующий аргумент не заключен в кавычки, то это работает. Все, что после того, что распознается как команда / программа, передается в качестве параметра этой команде / программе. Примечание это не будет работать, если программа командой/имеет пробелы в имени, например,VBox Headless.exe, так как это потребует кавычек и будет признано в качестве названия.


в целом, первый (явное название) метод, вероятно, лучше. Это был плохой выбор дизайна со стороны Microsoft, они действительно должны были добавить переключатель для заголовка, а не “первый аргумент, заключенный в кавычки?”.