VideoHelp Forum


Try NordVPN to access Netflix or other streaming services from any country and also surf safely!
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Could someone help me make a bat file to make a program close down then start again, or maybe restart is the term

    I have the start part, what goes before it?
    @echo off


    Start "" "C:\Program Files (x86)\myprogram.exe"
    Isn't the echo off supposed to stop the black command window opening? I have another bat file and the window stays open. It has the echo off

    edit: I see the echo off is not to stop the window opening. How do you stop it opening or make it close.
    Thanks
    Last edited by David Banner; 6th May 2021 at 13:57.
    Quote Quote  
  2. Kawaiiii
    Join Date
    May 2021
    Location
    Italy
    Search Comp PM
    echo off simply disable the command echo-ing.. so every line in the batch file doesn't echo itself in the terminal window. It has the @ before to avoid to echo-ing in the command window itself

    If the program starts correctly the command window should close automatically.

    To kill a process, then relaunch it.. you can try:

    taskkill /IM myprogram.exe
    Start "My Program" "C:\Program Files (x86)\myprogram.exe"
    Quote Quote  
  3. Originally Posted by krykmoon View Post
    echo off simply disable the command echo-ing.. so every line in the batch file doesn't echo itself in the terminal window. It has the @ before to avoid to echo-ing in the command window itself

    If the program starts correctly the command window should close automatically.

    To kill a process, then relaunch it.. you can try:

    taskkill /IM myprogram.exe
    Start "My Program" "C:\Program Files (x86)\myprogram.exe"
    Thanks. Would the taskkill /IM myprogram.exe have the full path like the start?
    I find if i don't have "" between start and the path it just get a command windows with the path to the folder the bat file is in

    I just checked my other bat file the window does close actually
    Last edited by David Banner; 6th May 2021 at 14:35.
    Quote Quote  
  4. Kawaiiii
    Join Date
    May 2021
    Location
    Italy
    Search Comp PM
    Originally Posted by David Banner View Post
    Thanks. Would the taskkill /IM myprogram.exe have the full path like the start?
    No, since it's the program "image" name (the name it has like a process).

    If there are multiple instances of the same program or programs with the same name running.. to avoid conflict you should specify the specific process PID (and use /PID option instead)
    Quote Quote  
  5. Originally Posted by krykmoon View Post
    Originally Posted by David Banner View Post
    Thanks. Would the taskkill /IM myprogram.exe have the full path like the start?
    No, since it's the program "image" name (the name it has like a process).

    If there are multiple instances of the same program or programs with the same name running.. to avoid conflict you should specify the specific process PID (and use /PID option instead)
    OK I see

    OK I got it working except the GUI stays open. I need the code equivalent of clicking the _ to minimise to the task bar
    Last edited by David Banner; 18th Jul 2021 at 09:12.
    Quote Quote  



Similar Threads