To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here





 Home

News

Forums

Hardware

CPUs

Motherboards

Video

Guides

CPU Prices

RAM Prices

Shop



Sharky Extreme : Forums:


Go Back   Sharky Forums > General Hardware/Software > Programming, Coding, and Scripting

Programming, Coding, and Scripting Need help with questions about programming, coding, or scripting? Here's the place to ask for it.

Reply
 
Thread Tools Search this Thread Display Modes
Old 03-01-2005, 08:59 PM   #1
Stasis
Reef Shark
 
Stasis's Avatar
 
Join Date: May 2001
Location: Wenatchee, WA, USA
Posts: 373
programming wait, in batch files

One of our dns servers at work is messing up or something and I keep getting the external IP for intranet (since it can be accessed outside, but you cant double-NAT to it) and a simple fix for the mean time till I can figure out what the main problem is, is to bring up a command prompt and run

Net stop "dns client"

Net start "dns client"

and that re-queries the dns (i think) and temporarly fixes the issue.

It normally takes a few seconds for the first command to finish executing, so I want to have my batch file run the first, wait about 5seconds, then run the second. Ive researched a bit on the net and ive found alot of people saying to create a 2nd batch file and then call it within the first...id rather not do that, and id rather not use the pause command. Id like it to be automated, merely beacuse I want to see how to do it

any ideas?

im running winxp.
Stasis is offline   Reply With Quote
Old 03-01-2005, 10:41 PM   #2
Bearded Kirklander
 
Bearded Kirklander's Avatar
 
Join Date: Sep 2004
Location: United States
Posts: 11,814
Google has some good results:

http://labmice.techtarget.com/articles/batchcmds.htm

http://www.cknow.com/tutorcom/batch03_subcmd1.htm

I just typed in PAUSE IN BATCH FILE in Google.

hope some of that helps.
Bearded Kirklander is offline   Reply With Quote
Old 03-01-2005, 11:43 PM   #3
Nick_B
Hammerhead Shark
 
Join Date: Mar 2001
Location: Golden, CO
Posts: 2,636
There ought to be a sleep command of some sort, but then again, windows scripting isn't my thing.

This machine has sleep on it, but I think it's a cygwin thing. If you don't want to install anything additional and this is really just a temporary quick-fix type of situation, you can always loop the batch file and do something pointless to keep it busy for a few seconds.

This is all kinds of hackish and pretty stupid, but it slows this machine down for about 5 seconds:

Code:
@ECHO OFF
for %%i in (1,2,3,4,5,6,7,8,9,0,a,b,c,d,e,f) 
  do for %%j in (1,2,3,4,5,6,7,8,9,0,a,b,c,d,e,f)
  do echo . > blah
Have fun and good luck.

Oh, and another avenue is to use windows scripting host. I'm positive it's powerful enough to stop and start services and has to have some sort of sleep function.

EDIT: The indented pieces should be on the same line, but it caused vB to wrap nasty-like.
__________________
Nick_B
Currently running: Ubuntu.

Last edited by Nick_B; 03-01-2005 at 11:44 PM.
Nick_B is offline   Reply With Quote
Old 03-01-2005, 11:53 PM   #4
Bearded Kirklander
 
Bearded Kirklander's Avatar
 
Join Date: Sep 2004
Location: United States
Posts: 11,814
You could write a little EXE in Delphi or something that does a simple pause for x number of seconds (passed by command line argument) I guess. I used to do that in Quick Basic 4.5 back in the day.
Bearded Kirklander is offline   Reply With Quote
Old 03-02-2005, 01:25 PM   #5
I4one
BozoKiller
 
Join Date: Oct 2003
Location: Zoso
Posts: 7,636
use a double ampersands && in between the commands
so;

Net stop "dns client" && Net start "dns client"

more examples;
FORMAT A: /Q && COPY C:\DATA\*.* A:
will copy all files from C:\DATA to diskette IF and ONLY IF the format succeeds.

XCOPY C:\*.* D:\ /S 2>&1> NUL ¦¦ ECHO Something terrible happened
will display your own custom error message if XCOPY fails

the double pipes || is used to Execute command2 only if execution of command1 has finished unsuccessfully

Source

or even perhaps the Start /wait switch (which can be used with TIME)
__________________
Delete the Electoral College - Support
www.NationalPopularVote.com

"The world according to DRM Bozos"

I am a consumer, I'll buy anything
I am a sheep, I am cattle, I follow the herd
I am ignorant, a dumbass, and I am a bozo...
I am the epitome of the 'rank and file'
I am your next door neighbor
I am 95% of American Consumers
I will consume you
  • If the light in your head hasn't come on yet,
    I suggest you go get a new bulb!
I4one is offline   Reply With Quote
Old 03-02-2005, 01:40 PM   #6
Stasis
Reef Shark
 
Stasis's Avatar
 
Join Date: May 2001
Location: Wenatchee, WA, USA
Posts: 373
thanks for the help all, im going with I4ones solution on this one, its quick and easy and thats what i need works great, thanks.
Stasis is offline   Reply With Quote
Old 03-02-2005, 04:32 PM   #7
Bearded Kirklander
 
Bearded Kirklander's Avatar
 
Join Date: Sep 2004
Location: United States
Posts: 11,814
Good post, I.

I like learning new stuff. Did not know about that trick. Glad I do know. Thanks.
Bearded Kirklander is offline   Reply With Quote
Old 03-02-2005, 05:30 PM   #8
I4one
BozoKiller
 
Join Date: Oct 2003
Location: Zoso
Posts: 7,636
your welcome both - I finally was able to find an easy effecive solution - but thank rob vanderwoude, (see source). I like to fiddle with batfiles from time to time and really don't know that much (that's the extent of my programming knowledge ) - and you'll be giving me some solutions on occasion when necessary.
__________________
Delete the Electoral College - Support
www.NationalPopularVote.com

"The world according to DRM Bozos"

I am a consumer, I'll buy anything
I am a sheep, I am cattle, I follow the herd
I am ignorant, a dumbass, and I am a bozo...
I am the epitome of the 'rank and file'
I am your next door neighbor
I am 95% of American Consumers
I will consume you
  • If the light in your head hasn't come on yet,
    I suggest you go get a new bulb!
I4one is offline   Reply With Quote
Reply

Bookmarks
Go Back   Sharky Forums > General Hardware/Software > Programming, Coding, and Scripting


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 02:53 PM.




Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.