Run a batch file in a new window from batch?

前端 未结 7 2043
故里飘歌
故里飘歌 2020-12-24 06:54

I know it seems this has been asked before, but I need a batch to open another batch in a new window. I\'ve tried:

start abc.bat

cmd abc.bat

run abc.bat


        
相关标签:
7条回答
  • 2020-12-24 07:31

    It's a little bit strange that start abc.bat doesn't work but I assume this is because you are running this in the middle of another batch. You probably need call:

    22:22:38.85 c:\help call
    Calls one batch program from another.
    
    CALL [drive:][path]filename [batch-parameters]
    

    Giving you start call abc.bat or call start abc.bat depending on what the exact problem is.

    0 讨论(0)
  • 2020-12-24 07:38

    I found something that works:

    call "C:\FILEPATH HERE\abc"
    

    Demo:

    @echo off
    
    call "C:\Users\USERNAME HERE\Desktop\abc"
    

    This should work <3

    0 讨论(0)
  • 2020-12-24 07:39

    If you are going to run it in a different command prompt, type start C:\abc.bat or whatever the directory of abc.bat is, or if you want to open it in the same command prompt, type call "C:\abc.bat" again, wherever the directory is. It should work

    Either: call "C:\abc.bat" or start C:\abc.bat

    0 讨论(0)
  • 2020-12-24 07:45

    Is this what your after?

    start "New Window" cmd /c test.cmd
    
    0 讨论(0)
  • 2020-12-24 07:46

    To simply do it is just

    start cmd /c "exampleexample.bat"
    

    This could also work with spaces;

    start cmd /c "example example.bat"
    

    And directories.

    start cmd /c "C:\NAME\Example\Hi there\example example.bat"
    

    I created my universal batch with this and this works flawlessly.

    0 讨论(0)
  • 2020-12-24 07:46

    Unfortunatly, I know of no such method (I encounter the same thing). However, try killing the old window when you start the batch

    abc.bat:

    abd.bat
    stop
    

    abd.bat:

    @echo off
    @echo It works!
    
    0 讨论(0)
提交回复
热议问题