Detect if bat file is running via double click or from cmd window

前端 未结 12 1661
醉话见心
醉话见心 2020-12-29 02:54

I have a bat file that does a bunch of things and closes the cmd window which is fine when user double clicks the bat file from explorer. But if I run the bat file from a al

12条回答
  •  北海茫月
    2020-12-29 03:32

    Use exit /b 0, not exit

    The former will exit all the way if launched from Windows Explorer, but return to the console if launched from the command line.

提交回复
热议问题