V
V
ViktorGuerro2019-08-22 11:03:31
cmd/bat
ViktorGuerro, 2019-08-22 11:03:31

Why does a bat file of 2 lines take a long time to execute?

The task is to prohibit opening a second copy of the program for the user (in the example admin). But the process search takes a long time due to the use of filters. How to speed up the work of bat'nik?

tasklist /fi "USERNAME eq admin" | find /i "EasyCeiling.exe"
if %errorlevel%==1 (goto :Run0) else (goto :Run1)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
res2001, 2019-08-22
@res2001

tasklist generally works long enough.
Add filtering by EasyCeiling.exe to the filter, so that the tasklist gives out only the necessary processes, perhaps the speed will increase.
You can try other tools to get a list of processes, such as wmic. But I doubt that something else will be much faster.

E
Eugene, 2019-08-22
@yellowmew

https://habr.com/ru/post/212413/
Carefully study the comments, maybe you can solve your problem with their help (although I didn’t quite understand exactly how you want to solve it, but I rely on your independence)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question