'How to close the cmd window after the batch file run
I want to close the command prompt after the bat file run. From the bat file it's calling two python scripts and I have tried basic exit and many solutions to close the cmd in the bat file but non of were not working.
c:\python27\python.exe C:\Python27\EconomyNext\DetailEconomyNews.py %*
c:\python27\python.exe C:\Python27\EconomyNext\DetailFinanceNews.py %*
exit
Solution 1:[1]
Did you check this post: CMD Script: How to close the CMD
It has a few options depending on how you are calling the CMD like:
exit /b
or
start c:\python27\python.exe C:\Python27\EconomyNext\DetailEconomyNews.py %* && c:\python27\python.exe C:\Python27\EconomyNext\DetailFinanceNews.py %* && exit
Solution 2:[2]
A little late, but another option which worked from https://www.winhelponline.com/blog/run-bat-files-invisibly-without-displaying-command-prompt/
Running .BAT or .CMD files in minimized mode To run a batch file in a minimized window state, follow these steps:
- Create a shortcut to the .BAT or .CMD file. To do so, right click on the file, click Send To, Desktop (create shortcut)
- Right click on the shortcut and choose Properties
- In the Run: drop down, choose Minimized
- Click OK
- Double-click the shortcut to run the batch file in a minimized window state.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Paulo Silva |
Solution 2 | sand |