View Full Version : [SOLVED] Batch File Wont Stay Open
Rytron
October 16th, 2008, 04:04 AM
Hi,
I have a batch file.
Here is the code:
@echo off
arp -d *
nbtstat -R
ipconfig /flushdns
nbtstat -RR
ipconfig /registerdns
I click it but it just flashs and then closes. How can I make it stay open until I click a key to close it?
Thanks.
mobilediesel
October 16th, 2008, 04:17 AM
Hi,
I have a batch file.
Here is the code:
@echo off
arp -d *
nbtstat -R
ipconfig /flushdns
nbtstat -RR
ipconfig /registerdns
I click it but it just flashs and then closes. How can I make it stay open until I click a key to close it?
Thanks.
Add "pause" as the last line, then it will say "Press any key to continue . . ." and wait for you to finish reading. So make it look like this:
@echo off
arp -d *
nbtstat -R
ipconfig /flushdns
nbtstat -RR
ipconfig /registerdns
pause
That should do it.
Rytron
October 17th, 2008, 04:59 AM
Add "pause" as the last line, then it will say "Press any key to continue . . ." and wait for you to finish reading. So make it look like this:
@echo off
arp -d *
nbtstat -R
ipconfig /flushdns
nbtstat -RR
ipconfig /registerdns
pause
That should do it.
Excellent, that worked.
I also have this .bat file:
ipconfig /release
ipconfig /renew
pause
It just flashes. It wont stay open. Is there a fault with the above bode?
mobilediesel
October 17th, 2008, 05:51 AM
Excellent, that worked.
I also have this .bat file:
ipconfig /release
ipconfig /renew
pause
It just flashes. It wont stay open. Is there a fault with the above bode?
It's actually been about 6 months since I stopped using Windows entirely to use Ubuntu. If you have a shortcut to the batch file on the desktop, you can right-click and click "properties" and I believe there's an option to keep the window open after the batch file runs.
Vishal Agarwal
October 17th, 2008, 07:20 AM
You can put the sleep option also for automatic execution of next statement
like
sleep n seconds
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.