Jump to content



Photo

delay program start with bat file


  • Please log in to reply
6 replies to this topic

#1 username

username

    neowin mountaineer

  • Joined: 03-April 02
  • Location: West Virginia

Posted 22 September 2002 - 00:50

Is there a way i could make a bat file that would delay the running of a program to a set time?



i have a temp sensor program that starts when windows loads but it never work because the driver it uses loads after windows starts the program so i have to run in manually later. Is there a way a bat program could delay this program from starting (say 10sec) and then when it starts, the driver will have been loaded, and everything will be fine.



Thanks


#2 hurting101

hurting101

    -

  • Joined: 02-December 01

Posted 22 September 2002 - 00:56

Something like this should work:



ping -n 10 127.0.0.1>nul



(that'll uselessly ping yourself for about 10 seconds)



Or change 10 to another number for number of seconds to "wait". You also can do this with sleep.exe in one of the resource kits, if you want.

#3 OP username

username

    neowin mountaineer

  • Joined: 03-April 02
  • Location: West Virginia

Posted 22 September 2002 - 01:01

wow, thanks, you know i read about doing that with pinging but had i just didnt put the two together



so i would make that bat like this then?



ping -n 10 127.0.0.1>nul

C:Program FilesmbprobeMBProbe.exe

#4 hurting101

hurting101

    -

  • Joined: 02-December 01

Posted 22 September 2002 - 01:06

Originally posted by username

wow, thanks, you know i read about doing that with pinging but had i just didnt put the two together



so i would make that bat like this then?



ping -n 10 127.0.0.1>nul

C:Program FilesmbprobeMBProbe.exe




Close, but this would work better:

<pre>@echo off

ping -n 10 127.0.0.1>nul

start "" "C:Program FilesmbprobeMBProbe.exe"</pre>



Note:

@echo off : silence, to speed things up

ping : waits

start : starts the program and quits instead of waiting until the program is closed to quit the batch file

#5 OP username

username

    neowin mountaineer

  • Joined: 03-April 02
  • Location: West Virginia

Posted 22 September 2002 - 01:12

hey, thanks so much, this is perfect, made a shortcut to the bat file, and run in minimized, works great.



I was reading up on that but have no idea where to put anything in the script or what half the stuff even means, thanks again

#6 yashiro

yashiro

    Neowinian Senior

  • Joined: 13-November 01

Posted 22 September 2002 - 01:36

The ping delay method works great. It's one of my faves.

Much more efficient than creating a pointless loop (for /L %%t in (0,...) etc.



While were in prompt land, does anyone know a way to minimize an already running application using the DOS/NT CMD line?

#7 hurting101

hurting101

    -

  • Joined: 02-December 01

Posted 22 September 2002 - 01:40

wow, thanks

Any time ;)



The ping delay method works great. It's one of my faves.

Much more efficient than creating a pointless loop (for /L %%t in (0,...) etc.



While were in prompt land, does anyone know a way to minimize an already running application using the DOS/NT CMD line?




But FOR loops use 100% CPU :(. Sometimes I use "for /l %%i in (1,1,10000) do start" just to hurt me computer.



As for the minimize thing, you can use CMDOW, which can do alot of stuff. Haven't tested it yet, though.

http://www.commandli...mdow/index.html



Click here to login or here to register to remove this ad, it's free!