Richard
Wed Sep 05 06:08:52 PDT 2007
"systemtek" <duncan@systemtek.co.uk> wrote in message
news:1188996210.355831.250430@22g2000hsm.googlegroups.com...
> On 5 Sep, 13:27, "ThatsIT.net.au" <me@thatsit> wrote:
>> Also try
>>
>> objShell.exec
>>
>> "systemtek" <dun...@systemtek.co.uk> wrote in message
>>
>> news:1188994298.585482.44400@19g2000hsx.googlegroups.com...
>>
>> > On 5 Sep, 12:29, "ThatsIT.net.au" <me@thatsit> wrote:
>> >> "systemtek" <dun...@systemtek.co.uk> wrote in message
>>
>> >>news:1188987737.291381.204490@g4g2000hsf.googlegroups.com...
>>
>> >> > Hi looking for a bit of help, tried a few things but cant get it to
>> >> > work, i am trying to run the following DOS command line from a VBS
>> >> > script.
>>
>> >> > printmig -b "\\servername\file.cab" \\server1
>>
>> >> > Tried various ways but no luck can anyone help ?
>>
>> >> > Thanks
>>
>> >> set objShell = CreateObject("WScript.Shell")
>> >> objShell.run "printmig -b ""\\servername\file.cab"" \\server1"
>>
>> > Thanks, This seems to work but fail's at the end, if i look in the
>> > error log its trying to make this 'Backup".ca' and it should be
>> > 'Backup.cab' in the log file looking at a previous working attempt.
>>
>> > I should have said above you dont put the file extension of the file
>> > in for it to work its just :
>>
>> > set objShell = CreateObject("WScript.Shell")
>> > objShell.run "printmig -b ""\\servername\Backup"" \\server1"
>>
>> > And this should create a file called Backup.cab at the end of it
>> > automatic, but it is not.
>>
>> > If i run this as a dos command line it works fine.
>>
>> > Any ideas ?
>
> Tried this just get error box with " 0 " in it. Will have a play with
> it see if i can find out why.
>
To help troubleshoot, assign the dos command to a variable. Then you can
echo it to the command line and see if it is correct. It should look exactly
like the command you enter manually. For example:
==========
set objShell = CreateObject("WScript.Shell")
strCmd = "printmig -b ""\\servername\Backup"" \\server1"
Wscript.Echo strCmd
strError = objShell.Run(strCmd, 1, True)
Wscript.Echo "Return code = " & strError
==========
I would expect this to echo:
===========
printmig -b "\\Servername\Backup" \\server1
Return code = 0
==========
The return code will be 0 if no error was returned by printmig. If printmig
spawned another process that generated an error, then you won't get an error
code from the spawned process.
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab -
http://www.rlmueller.net
--