Command line doesn't work when called from VB6 with logging
I have put together the following command line:
schtasks /change /tn Shutdown /rp password /disable
If I run this from a cmd console, it works fine. I want to log the
results, because I'm actually calling this twice for two differently named
shutdown tasks, and I know one of them won't exist depending on the
server. I want to log both successes and errors. So I call this line from
the cmd console:
schtasks /change /tn Shutdown /rp password /disable >>
C:\logs\shutdown.log 2>&1
That works fine too. If I call the first version inside my VB6 code like
this:
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "schtasks /change /tn Shutdown /rp password /disable"
That also works no problem. But if I call it with the logging:
objShell.Run "schtasks /change /tn Shutdown /rp password /disable >>
C:\logs\shutdown.log 2>&1"
That does nothing. It doesn't lock up or log any errors, it just does
nothing at all. It doesn't even create an empty log file.
No comments:
Post a Comment