M
M
Maxim Mymrin2017-08-23 01:17:59
System administration
Maxim Mymrin, 2017-08-23 01:17:59

How to run a list of programs on Windows (using a program or a script), but so that there is a check of what is already running and what is not running-running?

1) I play a game .. But I need to run several programs with it at once .. For the keyboard, additional buttons are assigned there, etc. Only 4 or 5 pieces of programs to run along with the game .. How to make all programs run at once on one shortcut, but there was a preliminary check that it was already running .. If some program was running, then it did not start, but the rest started as usual ..Googling, gives out a mini program and how to make a script ..But there is no check whether the program is running or not ..
2) One program often hangs in the game. How to make a shortcut or a key combination ..To do it automatically ..(kill the desired process and restart the program) is there such a program or how to write a script or something ..

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin Luntovsky, 2017-08-23
@reifwp

Check and run the notepad if it is not running.
For /F %%I In ('tasklist ^| find /i /c "notepad"' ) Do (
rem echo "I = %%I"
If "%%I" == "0" (
rem echo "prog notepad" started"
) else (
rem echo "start notepad"
start notepad
)
)
Something like this.

S
Serezha, 2017-08-23
Ahen @Ahen

Write a script for powershell (win 10).
You can google the process check with the query "powershell check process exists".
On the second question - you can write a script on Autoit. It is possible to solve the first question on it.

R
res2001, 2017-08-23
@res2001

1.Write a batch file (bat or cmd) in which you will run your programs. It must be launched through start, otherwise the script will wait for the end of the running program to complete.
start/?
2. You can also kill the process through a batch file.
To kill a process, you can use the built-in taskkill command:
taskkill /?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question