How do I make a batch file that started a process to wait for the process to terminate?

Amitb01FUB

My computer isn't the best but it does meet the minimal requirments to play GTA V. I wanted to make the game run faster so instead of using the normal .exe, this is the batch file I use to launch the game:

start steam://rungameid/271590 
timeout 60
wmic process where name="GTA5.exe" CALL setpriority "high priority"
wmic process where name="gtavlauncher.exe" CALL setpriority "idle"
wmic process where name="subprocess.exe" CALL setpriority "idle"

so basically after launching the game it sets the priorities so only the GTA5.exe runs and the cpu ignores the other processes that come with it. I wanted it to run even smoother and changing the windows theme to "classic" helps with that, so I downloaded a program that allowes me to change the themes with cmd commands and I made this script-

START c:\ThemeSwitcher classic
start steam://rungameid/271590 
timeout 60
wmic process where name="GTA5.exe" CALL setpriority "high priority"
wmic process where name="gtavlauncher.exe" CALL setpriority "idle"
wmic process where name="subprocess.exe" CALL setpriority "idle"
wait process where name="GTA5.exe" 
-----------------------------------------------------------
start c:\ThemeSwitcher MY PC

in the "----------" I want to put something that makes the file wait for the processes to terminate before changing the theme to normal, so I don't have to do it manually. I only know a few batch commands that I used google for, and right now it doesn't help. sorry for bad english.

Adam Silenko

create batch like this:

title i'm waiting
start /wait /high cmd /ktitle kill me 
echo This is the end 
pause

you can see how work start command with wait parameter

you can create batch with pause, after do something hit space in batch window, then it run next command

you probably looking for something like waiting for terminate existing process:

echo do somthing at start
:start_test
::wait ~6s -1s = 5s
::you can use TIMEOUT 5
call :sleep 6
wmic process where name="notepad.exe" get name |find "notepad.exe">nul
if %errorlevel%==0 goto :start_test
echo do somthing at the end
::pause
goto :eof

:sleep
ping 127.0.0.1 -n %1 > nul
goto :eof

it test process exists every 5s, you can change interval.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I programmatically terminate a running process in the same script that started it?

From Dev

How do I make a batch file wait / sleep for some seconds?

From Dev

How to start detached process and wait for the parent to terminate?

From Dev

How to wait for each process to terminate in the following example?

From Dev

How do I make a timer run in a Tkinter widget while a process, started by the widget, is running?

From Dev

How do I make a timer run in a Tkinter widget while a process, started by the widget, is running?

From Dev

Wait a process is fully started

From Dev

wait for process to end in windows batch file

From Dev

Wait for child process to terminate in R

From Dev

Wait for child process to terminate in R

From Dev

How do I get the process ID of a process that is started by cmd line (which is started by me)?

From Dev

how do I merge 2 images with the same file names into one in a batch process? Is there a prgram that can do this?

From Dev

How can i terminate process created with winexec()?

From Dev

How do I rename a file via batch using Process in c#

From Dev

How do I process text file into an array?

From Dev

How to terminate a background process?

From Dev

End a process started with START command in a Windows Batch File

From Dev

Can a child process wait for the parent process to terminate in Linux programming in C?

From Dev

How to make a batch file wait for fractions of a second?

From Dev

How do I make a shell script that sends output to a process

From Dev

How do I respond to a prompt after using & to make a new process?

From Dev

How to terminate a hung process in SSH?

From Dev

How to terminate System Idle Process?

From Dev

Batch - How to wait for process with specific name so start and finish?

From Dev

Batch - How to wait for process with specific name so start and finish?

From Dev

How do I make a batch file the default application for a file type

From Dev

Matlab Actxserver :How could I terminate process opened by actxserver in matlab

From Dev

Matlab Actxserver :How could I terminate process opened by actxserver in matlab

From Dev

How can I make a VBS Script that doesn't wait for a process to finish?

Related Related

  1. 1

    How can I programmatically terminate a running process in the same script that started it?

  2. 2

    How do I make a batch file wait / sleep for some seconds?

  3. 3

    How to start detached process and wait for the parent to terminate?

  4. 4

    How to wait for each process to terminate in the following example?

  5. 5

    How do I make a timer run in a Tkinter widget while a process, started by the widget, is running?

  6. 6

    How do I make a timer run in a Tkinter widget while a process, started by the widget, is running?

  7. 7

    Wait a process is fully started

  8. 8

    wait for process to end in windows batch file

  9. 9

    Wait for child process to terminate in R

  10. 10

    Wait for child process to terminate in R

  11. 11

    How do I get the process ID of a process that is started by cmd line (which is started by me)?

  12. 12

    how do I merge 2 images with the same file names into one in a batch process? Is there a prgram that can do this?

  13. 13

    How can i terminate process created with winexec()?

  14. 14

    How do I rename a file via batch using Process in c#

  15. 15

    How do I process text file into an array?

  16. 16

    How to terminate a background process?

  17. 17

    End a process started with START command in a Windows Batch File

  18. 18

    Can a child process wait for the parent process to terminate in Linux programming in C?

  19. 19

    How to make a batch file wait for fractions of a second?

  20. 20

    How do I make a shell script that sends output to a process

  21. 21

    How do I respond to a prompt after using & to make a new process?

  22. 22

    How to terminate a hung process in SSH?

  23. 23

    How to terminate System Idle Process?

  24. 24

    Batch - How to wait for process with specific name so start and finish?

  25. 25

    Batch - How to wait for process with specific name so start and finish?

  26. 26

    How do I make a batch file the default application for a file type

  27. 27

    Matlab Actxserver :How could I terminate process opened by actxserver in matlab

  28. 28

    Matlab Actxserver :How could I terminate process opened by actxserver in matlab

  29. 29

    How can I make a VBS Script that doesn't wait for a process to finish?

HotTag

Archive