Question:
How to make a .bat file wait?
Mc
2008-11-20 01:30:15 UTC
I am on the works computer and my IT department rather helpfully thinks its so slow because of its age (which is bs). I have found an executable running @ 99%CPU but have no task manager to stop it, so what i have done is made a .bat file with the taskkill /f /im .exe and placed it in the start-up folder. Unfortunately it runs too early and .exe runs after the .bat file so i was wondering if anyone knew how to delay the running of taskkill that i can write into the .bat file.

There.. I hope that makes some sense
Six answers:
2008-11-20 01:38:15 UTC
You can ping fake host and set the timeout delay to how long you want it to wait.



PING 1.1.1.1 -n 1 -w 60000 >NUL
Shiladitya
2008-11-20 01:43:00 UTC
Below is an example of how to delay a batch file any where from 5 to 99 seconds. In the below example we illustrate a 5 second delay.



TYPE NUL | CHOICE.COM /N /CY /TY,5 >NUL
Sasibindu K Chevuru
2008-11-20 01:43:15 UTC
You can use Scheduled tasks to perform it.

Create a scheduled job in Control Panel --> Scheduled jobs and make it to run only if logged on.



Also you can add your batch file under:



HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run



At the end, add another string value and give full path of your batch file.



Please let me know if this does not fix your problem.
2016-04-08 01:05:12 UTC
Instead of calling "start" to run the executables, just call the executables directly. That way application.exe won't run until autorun.exe terminates.
☆☆♥☆☆ ☆αℓℓ☆ ☆gσσ∂☆ ☆Thiηgs☆☆
2008-11-20 01:41:59 UTC
To make a .bat file, you can go into the C:Command Prompt



(I.E the dos operating system)



Type: Edit Test.bat





(Test being the file name)



.bat being short for batch file
The Drunken Fool
2008-11-20 01:37:14 UTC
can you rename the offending program so it doesnt start at all?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...