PDA

View Full Version : Script window doesn't close after starting program... (All)



rem2500
03-24-2006, 09:01 AM
I have a script running on our Windows network. I recently added a line to start a specific program that is located on one of the network drives. When the script runs, it maps the drives, starts up the program and then the window that the script runs in just sits there. I have tried putting 'exit' and other eof lines in there but nothing seems to work because it seems that the script basically stops running after it calls that program. Anyone have any ideas as to how I can make it continue after it calls that program? My users are driving me crazy because they dont like having to close that box.

Any help would be much appreciated!
REM2500

jdharm
03-24-2006, 10:24 AM
You say "script", but do you mean "batch file"? If you do, try using cls instead of exit.

Josh
<a target="_blank" href=http://www.jdharm.com>www.jdharm.com</a>

monkey_1
03-24-2006, 11:12 AM
If is a batch file don't use START command for launch the program, instead use just the path to the program...

_______
<font color=orange>Mono</font color=orange>

motoflop
03-25-2006, 12:32 PM
Use START command to start your program. if you don't use START, control will return to script only after your program has ended. Here is simple example (store it as tester.bat)

@echo off
start notepad.exe
exit

If you run this, it opens notepad and closes script window instantly. But if you remove "start", the script window will be there until you close notepad.

monkey_1
03-25-2006, 04:08 PM
Yes motoflop, you're right, I was thinking in the opposite way /images/forums/icons/crazy.gif ...

_______
<font color=orange>Mono</font color=orange>

cprasley
04-11-2006, 03:05 PM
If you're really running a script (as opposed to a BATCH file), there is an argument to the WshShell object's run() method that tells it not to wait for the child process to complete, as in

RESULT = oWsh.Run("C:\Program Files\MyChildProgram.exe",1,False);