How to create batch file in Windows using “start” with a path and command with spaces

前端 未结 7 1499
孤独总比滥情好
孤独总比滥情好 2020-11-27 12:54

I need to create a batch file which starts multiple console applications in a Windows .cmd file. This can be done using the start command.

However, the command has

相关标签:
7条回答
  • 2020-11-27 13:24

    Actually, his example won't work (although at first I thought that it would, too). Based on the help for the Start command, the first parameter is the name of the newly created Command Prompt window, and the second and third should be the path to the application and its parameters, respectively. If you add another "" before path to the app, it should work (at least it did for me). Use something like this:

    start "" "c:\path with spaces\app.exe" param1 "param with spaces"
    

    You can change the first argument to be whatever you want the title of the new command prompt to be. If it's a Windows app that is created, then the command prompt won't be displayed, and the title won't matter.

    0 讨论(0)
  • 2020-11-27 13:24

    I researched successfully and it is working fine for me. My requirement is to sent an email using vbscript which needs to be call from a batch file in windows. Here is the exact command I am using with no errors.

    START C:\Windows\System32\cscript.exe "C:\Documents and Settings\akapoor\Desktop\Mail.vbs"
    
    0 讨论(0)
  • 2020-11-27 13:26

    You are to use something like this:

    start /d C:\Windows\System32\calc.exe

    start /d "C:\Program Files\Mozilla

    Firefox" firefox.exe start /d

    "C:\Program Files\Microsoft

    Office\Office12" EXCEL.EXE

    Also I advice you to use special batch files editor - Dr.Batcher

    0 讨论(0)
  • 2020-11-27 13:27

    Escaping the path with apostrophes is correct, but the start command takes a parameter containing the title of the new window. This parameter is detected by the surrounding apostrophes, so your application is not executed.

    Try something like this:

    start "Dummy Title" "c:\path with spaces\app.exe" param1 "param with spaces"
    
    0 讨论(0)
  • start "" "c:\path with spaces\app.exe" "C:\path parameter\param.exe"
    

    When I used above suggestion, I've got:

    'c:\path' is not recognized a an internal or external command, operable program or batch file.

    I think second qoutation mark prevent command to run. After some search below solution save my day:

    start "" CALL "c:\path with spaces\app.exe" "C:\path parameter\param.exe"
    
    0 讨论(0)
  • 2020-11-27 13:30

    Interestingly, it seems that in Windows Embedded Compact 7, you cannot specify a title string. The first parameter has to be the command or program.

    0 讨论(0)
提交回复
热议问题