vbscript works differently in a dos prompt and in explorer
Posted: Wed Dec 12, 2007 10:55 am
feyd | Please use
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have a strange problem and need your help. Maybe it is the wrong forum but in this case, any advice on a goob forum to help with vbs will be greatly appreaciated.
So my problem:
I have a vbs script in windows that execute several command (exe and batch file).
The script works prefectly when I execute it in a command prompt but it does not work the same way when executed from explorer (by double clicking on it) and runs in the windows scheduler.
In ideas why?
here is the script :
[syntax="vb"]Dim objShell
Set objShell = wscript.CreateObject("WScript.Shell")
'=============================
dtmToday = Date()
dtmLastMonth = Date() - 31
'========================================================
iReturn = objShell.Run("cmd.exe /C c:\authmgr\utils\rptconnect start batch",1,TRUE)
'========================================================
iReturn = objShell.Run("cmd.exe /C c:\authmgr\utils\sdrptrun.bat C:\authmgr\utils\cust_rpt\pcaccept.p" &chr(32) &dtmLastMonth &chr(32) &dtmToday,1,TRUE)
iReturn = objShell.Run("cmd.exe /C c:\authmgr\utils\sdrptrun.bat C:\authmgr\utils\cust_rpt\pcincorr.p" &chr(32) &dtmLastMonth &chr(32) &dtmToday,1,TRUE)
iReturn = objShell.Run("cmd.exe /C c:\authmgr\utils\sdrptrun.bat C:\authmgr\utils\cust_rpt\sdastart.p" &chr(32) &dtmLastMonth &chr(32) &dtmToday,1,TRUE)
'========================================================
iReturn = objShell.Run("cmd.exe /C c:\authmgr\utils\rptconnect stop batch",1,TRUE)
'=================feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]