Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invoking perl from shell.exec hangs and never ends

Status
Not open for further replies.

HoustonGSC

IS-IT--Management
May 11, 2007
13
US
I have a VBScript that invokes a Perl command line to process a file.

set objCmd = WShell.Exec(OutCmd2Exec)
Do Until objCmd.Status
Wscript.Sleep 1000
Loop

Where OutCmd2Exec is :
perl c:\gsc_scripts\lawson.pl
"E:\FTPfiles\lawrpt\failed\20100218081721.352414"


For most of the files the perl script processes fine except for one particular file.
The kicker is if I execute the perl command against the file directly from a command line it processes fine but if it is invoked from within the VBScript, it just hangs and never ends.

Has anyone encountered this kind of problem or have any suggestions at what I might look at?

 
I've been experimenting while waiting for some feedback and I tried changing the WShell.Exec to a WShell.Run and that seems to work w/o a problem.
Curious to know why the Shell exec wouldn't work?
 
Do Until objCmd.Status
Wscript.Sleep 1000
Loop


my question would be 'do until objCmd.Status what?'

i guess if you dont put something like

Do Until objCmd.Status = 0

then it will trust override of implicitly think you mean??? = 0 or = "" or is empty or null, actually i think it might think you mean Do Until objCmd.Status = True? which will never happen? either way, it pays to be clear
 
Although I can see your point, I have always used the code Do Until objCmd.Status which resolves to True once the command is finished. For clarity it would make sense to expand the full code and add the = True argument.

I will make this change and test again when I have the opportunity, however, I dont think that this is what is keeping the command from returning.

I ended up just using the run method and it has been working fine but I sure would like to know if there are other limitations to the exec method or if it is something specific to perl etc.

Thanks for the feedback.
 
the other examples i have seen use Status = 0 i believe, i cant recall seeing one with Status = True, i would use the 0 or 1 or whatever the other examples from MS use
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top