Subject: Execute command lines from ASP????
Posted By: MAtkins Post Date: 12/2/2003 2:54:44 PM
Hi:

Can I execute command lines from w/in ASP?

I tried this and it just locks up the browser.
In fact everything I tried either returned an integer, 1 into RetCode or just locked up the browser permanently:
Can I find out what error the integer represents?


Set WShShell = Server.CreateObject("WScript.Shell")
RetCode = WShShell.run("cmd cd c:\MRDBackup", ,False)
If RetCode = 0 Then
    sErr = "Install Created"
Else
    sErr = "ERROR: Install Not Created: " & RetCode
End If        


Reply By: pgtips Reply Date: 12/4/2003 8:33:57 AM
does MRDBackup raise any prompts to the user?  If it does, that will be the cause of the hang.
Reply By: MAtkins Reply Date: 12/4/2003 9:40:03 AM
No, it doesn't. It can return lines in DOS but it's got switch /V0 which I'm using which means verbose=none.

Reply By: pgtips Reply Date: 12/4/2003 10:33:53 AM
I'm at a loss then, I'm afraid.  The return code of 1 is just whatever the command returns (if it doesn't have any specific exit codes for different errors, then it will just return 1 if it fails and 0 if it succeeds - not much help really).

You could try using the Exec method of the WshShell object instead, since that is specififcally designed for command-line programs, but I don't know if this will help coz Run should work just fine...
Reply By: MAtkins Reply Date: 12/4/2003 10:53:36 AM
quote:
Originally posted by pgtips

I'm at a loss then, I'm afraid.  The return code of 1 is just whatever the command returns (if it doesn't have any specific exit codes for different errors, then it will just return 1 if it fails and 0 if it succeeds - not much help really).

You could try using the Exec method of the WshShell object instead, since that is specififcally designed for command-line programs, but I don't know if this will help coz Run should work just fine...



Hmm, just my luck. Well, it's working through my VB component (go fig'r). It's an extra step but I guess I'll have to live with it.

Thanks for your help


Go to topic 7173

Return to index page 992
Return to index page 991
Return to index page 990
Return to index page 989
Return to index page 988
Return to index page 987
Return to index page 986
Return to index page 985
Return to index page 984
Return to index page 983