hmaloney
asked on
Using wshell to run a .bat file
Hi there,
I've looked through the various topics on this, and have tried these two pieces of code, both without success:
Dim wshell, proc
set wshell = server.createobject("wscri pt.shell")
set proc = wshell.exec("%comspec% /c 7za a -tzip XNWFRA_5JUN20065953.zip XNWFRA_5JUN20065953.xml @listfile.txt", 0, True)
This is the error I get on the last line above:
Microsoft VBScript runtime error '800a01c2'
Wrong number of arguments or invalid property assignment: 'exec'
/TestZip.asp, line 7
Please note, the part of the line that reads thus:
7za a -tzip XNWFRA_5JUN20065953.zip XNWFRA_5JUN20065953.xml @listfile.txt
is the commands required to zip up a set of files using 7zip a command line zip utility.
Now, when I have that line inside a .bat file and execute the .bat file "manually" on the webserver, it does exactly what it is meant to do.
The other way I have tried to do this is using the following code:
set wshell = Server.CreateObject("WScri pt.Shell")
wshell.run "c:\Listings\tempFiles\RCz ip.bat"
set wshell = nothing
Nothing happens, and I get no error.
I have given IUSR_ full permissions on the folder containing the batch file.
If someone could help me, I woul dbe most obliged!
Regards,
Heather
I've looked through the various topics on this, and have tried these two pieces of code, both without success:
Dim wshell, proc
set wshell = server.createobject("wscri
set proc = wshell.exec("%comspec% /c 7za a -tzip XNWFRA_5JUN20065953.zip XNWFRA_5JUN20065953.xml @listfile.txt", 0, True)
This is the error I get on the last line above:
Microsoft VBScript runtime error '800a01c2'
Wrong number of arguments or invalid property assignment: 'exec'
/TestZip.asp, line 7
Please note, the part of the line that reads thus:
7za a -tzip XNWFRA_5JUN20065953.zip XNWFRA_5JUN20065953.xml @listfile.txt
is the commands required to zip up a set of files using 7zip a command line zip utility.
Now, when I have that line inside a .bat file and execute the .bat file "manually" on the webserver, it does exactly what it is meant to do.
The other way I have tried to do this is using the following code:
set wshell = Server.CreateObject("WScri
wshell.run "c:\Listings\tempFiles\RCz
set wshell = nothing
Nothing happens, and I get no error.
I have given IUSR_ full permissions on the folder containing the batch file.
If someone could help me, I woul dbe most obliged!
Regards,
Heather
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks, glad to hear it works.
ASKER