Click to See Complete Forum and Search --> : keeping dos window open


TinaBanana
03-26-2007, 02:09 PM
i am writing a perl script that does a bunch of edits to some html files.
i have installed activeperl so i am able to launch the script by double clicking on it in windows explorer.

my problem is that the script runs and closes the dos window right away so i cannot see the output of the script (how many files were edited)

is there a way of keeping the file open so i can see the output? (another way then running the script from dos)

Watts
03-26-2007, 04:58 PM
You can open a shortcut to the dos prompt (command prompt) and then type your command C:\perl\bin perl whatever.pl and the window will stay open... OR you can add:

#leave window open so end-user can read screen
sleep(10);

to the bottom of your script and the window will close after 10 seconds. There may be a better, more politically correct way, but it works for me.

You could also install personal web server and run the script in your browser if you so desired. I've migrated to running everything via webserver so it's a little less cryptic for the others on the network.

jasonahoule
03-26-2007, 05:26 PM
The way I have solved this problem is by creating a .bat file and running the script from there. Here is the contents of my "run.bat" file

@ECHO off
start "Find and Replace" cmd /k perl findAndReplace.pl

The "/k" is what keeps the window open.

TinaBanana
03-27-2007, 09:29 AM
the bat file works great...exactly what i was looking for thx.

TinaBanana
03-29-2007, 11:48 AM
this works better

print "\nPress ENTER to exit... ";
<STDIN>;