Home / Microsoft / Microsoft DOS / Batch scripting
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: Batch scripting  (Read 650 times)
goerge
Guest
« on: June 29, 2006, 08:02:38 AM »

i would like to time / schedule the  execution of this batch file..
between the questioned marked spaces for 60 seconds each before executing the next command line
please help.

@echo off
????????
mkdir new
cd new
?????????
xcopy e:\try *.*/e/a/k/q
« Last Edit: June 29, 2006, 08:50:38 AM by goerge » IP logged
GuruGary
Adviser



Posts: 771




« Reply #1 on: June 29, 2006, 03:55:06 PM »

So you want a 60 second pause where the ???'s are?

Then try this:
Code: [Select]
@echo off
ping -n 61 localhost >NUL
mkdir new
cd new
ping -n 61 localhost >NUL
xcopy e:\try *.*/e/a/k/q
IP logged
ghostdog74
Mentor



Thanked: 26
Posts: 1,511


« Reply #2 on: June 29, 2006, 06:22:10 PM »

XP comes with sleep (or maybe the resource kit) ,you can use that too.
IP logged

dakota
Guest
« Reply #3 on: June 29, 2006, 09:50:28 PM »

if this is not for you or for use on a multipul pc's you could do somthing like this

set /a time1=0
:loop1
set /a time1=%time1%+1
if %time1% == put # here that last for about 60 sec goto endloop
goto loop1
:endloop
your code to do when timer is done

« Last Edit: June 29, 2006, 09:50:48 PM by dakota » IP logged
GuruGary
Adviser



Posts: 771




« Reply #4 on: June 29, 2006, 10:32:45 PM »

Yes, SLEEP.EXE does come with the Windows Resource Kit, which is a free download from Microsoft.  If you don't mind downloading a program, the SLEEP.EXE is the best soulution.

If you want something that will work with Windows, without having to download any additional programs, the PING command works pretty well as a timer, and uses very little resources.

Dakota's idea will work, but it will take some experimenting, and it will probably use a lot of CPU time.
IP logged
ghostdog74
Mentor



Thanked: 26
Posts: 1,511


« Reply #5 on: June 30, 2006, 01:27:08 AM »

That's where it breaks. why isn't sleep.exe bundled together with the OS baffles me, as i see it should be one useful command in batch programming. even things like choice , as i saw in previous post someone says it is not bundled in XP... thus, breaking old batch code if they were to be run in XP...
IP logged

goerge
Guest
« Reply #6 on: June 30, 2006, 03:04:02 AM »

Hi sir!
i can only address you as sir. I am thankfull for your correct and working reply.
The code is good but i am kindly requesting us assist in more. I would like also want the batch file to execute in the background. i.e. not to display the command prompt window....

thanx

Quote
So you want a 60 second pause where the ???'s are?

Then try this:
Code: [Select]
@echo off
ping -n 61 localhost >NUL
mkdir new
cd new
ping -n 61 localhost >NUL
xcopy e:\try *.*/e/a/k/q
IP logged
goerge
Guest
« Reply #7 on: June 30, 2006, 03:05:25 AM »

Thank you sir!
IP logged
uli_glueck
Guest
« Reply #8 on: June 30, 2006, 06:45:08 AM »

Quote
Hi sir!
 I would like also want the batch file to execute in the background. i.e. not to display the command prompt window....

Start it with the command scheduler "at".
Or use "soon" from the ressource kit.

hope it helps
uli
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / Batch scripting « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.103 seconds with 20 queries.