Close a command prompt CMD?
Solved
Dkeagle1911
Posted messages
57
Status
Membre
-
crapoulou Posted messages 28002 Registration date Status Modérateur, Contributeur sécurité Last intervention -
crapoulou Posted messages 28002 Registration date Status Modérateur, Contributeur sécurité Last intervention -
Hello,
I wrote a small batch script intended to restart a program as simply as possible:
The program restarts in 1/10 of a second, no problem...
Well, yes!
As soon as the "taskkill" executes, it opens a command prompt just to tell me
"Operation successful: the process "software.exe" with PID 9999 has been terminated."
How can I close this window directly (or even prevent it from appearing at all)? Its appearance breaks the simple principle of my script...
Thank you!
Configuration: Windows 7 / Chrome 54.0.2840.59
I wrote a small batch script intended to restart a program as simply as possible:
@echo off taskkill /im software.exe /F "C:\Program Files\folder\software.exe" exit
The program restarts in 1/10 of a second, no problem...
Well, yes!
As soon as the "taskkill" executes, it opens a command prompt just to tell me
"Operation successful: the process "software.exe" with PID 9999 has been terminated."
How can I close this window directly (or even prevent it from appearing at all)? Its appearance breaks the simple principle of my script...
Thank you!
Configuration: Windows 7 / Chrome 54.0.2840.59
5 réponses
Hello,
To close
:quit
Or quit without the :
Or you can convert a .bat to .exe with bat to exe converter
It seems to me that the cmd window doesn't show up, or if you don't want it to.
https://www.commentcamarche.net/telecharger/developpement/4555-bat-to-exe-converter/
To close
:quit
Or quit without the :
Or you can convert a .bat to .exe with bat to exe converter
It seems to me that the cmd window doesn't show up, or if you don't want it to.
https://www.commentcamarche.net/telecharger/developpement/4555-bat-to-exe-converter/
Hello,
Try this:
Try this:
@echo off taskkill /im software.exe /F >nul "C:\Program Files\folder\software.exe" exit
No, I don't have a video with the >null, but the only change is that the cmd window, instead of displaying "Operation successful" etc., simply shows nothing
but it is still there and unfortunately does not close by itself
I have to go and close it myself by clicking on it,
for an operation that I wanted to be simple and quick with a .bat file, that's one click too many xD
but it is still there and unfortunately does not close by itself
I have to go and close it myself by clicking on it,
for an operation that I wanted to be simple and quick with a .bat file, that's one click too many xD
Hello, I don’t know if I can help you, but here’s how I personally use my taskkill on Windows 10:
C:\Windows\System32\taskkill.exe /F /FI "USERNAME eq *session_name* /FI "IMAGENAME ne explorer.exe" /FI "IMAGENAME ne dwm.exe" /FI "IMAGENAME ne sihost.exe"
This has the effect of closing EVERYTHING except explorer.exe / dwm.exe and sihost.exe
and I don't have any window left open
In doubt, reboot! When it fails, format!
LePetitJimmy
C:\Windows\System32\taskkill.exe /F /FI "USERNAME eq *session_name* /FI "IMAGENAME ne explorer.exe" /FI "IMAGENAME ne dwm.exe" /FI "IMAGENAME ne sihost.exe"
This has the effect of closing EVERYTHING except explorer.exe / dwm.exe and sihost.exe
and I don't have any window left open
In doubt, reboot! When it fails, format!
LePetitJimmy
I just made a short video of the problem, so that everyone understands exactly WHERE it is...
The code executes fine, Rainmeter, which manages my desktop, restarts properly (you can see it restarting in the video)
but the code opens a CMD just to confirm that it has indeed closed the process before restarting it, and this window, I have to close it manually
https://www.youtube.com/watch?v=6dH0EHp5f1M&feature=youtu.be
Thank you ^^
The code executes fine, Rainmeter, which manages my desktop, restarts properly (you can see it restarting in the video)
but the code opens a CMD just to confirm that it has indeed closed the process before restarting it, and this window, I have to close it manually
https://www.youtube.com/watch?v=6dH0EHp5f1M&feature=youtu.be
Thank you ^^
the :quit doesn't change anything, it still opens a cmd window to tell me that the operation is successful
the quit (without the :) simply tells me that "quit is not a valid Windows command"
I'm testing by converting the .bat to .exe and I'll keep you updated
Thank you very much
I’ll mark the topic as "resolved"