Hide Command Window of .BAT file that Executes Another .EXE File

前端 未结 15 1946
猫巷女王i
猫巷女王i 2020-12-02 12:50

This is a batch file in Windows.

Here is my .bat file

@echo off
copy \"C:\\Remoting.config-Training\" \"C:\\Remoting.config\"

\"C:\\ThirdPar         


        
相关标签:
15条回答
  • 2020-12-02 13:41

    Using start works for me:

    @echo off
    copy "C:\Remoting.config-Training" "C:\Remoting.config"
    start C:\ThirdParty.exe
    

    EDIT: Ok, looking more closely, start seems to interpret the first parameter as the new window title if quoted. So, if you need to quote the path to your ThirdParty.exe you must supply a title string as well.

    Examples:

    :: Title not needed:
    start C:\ThirdParty.exe
    
    :: Title needed
    start "Third Party App" "C:\Program Files\Vendor\ThirdParty.exe"
    
    0 讨论(0)
  • 2020-12-02 13:44

    You can create a VBS script that will force the window to be hidden.

    Set WshShell = WScript.CreateObject("WScript.Shell")
    obj = WshShell.Run("""C:\Program Files (x86)\McKesson\HRS
    Distributed\SwE.bat""", 0)
    set WshShell = Nothing
    

    Then, rather than executing the batch file, execute the script.

    0 讨论(0)
  • 2020-12-02 13:45

    I haven't really found a good way to do that natively, so I just use a utility called hstart which does it for me. If there's a neater way to do it, that would be nice.

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