[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Using wshell to run a .bat file

Posted on 2006-06-04
3
Medium Priority
?
444 Views
Last Modified: 2008-02-01
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("wscript.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("WScript.Shell")
wshell.run "c:\Listings\tempFiles\RCzip.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
0
Comment
Question by:hmaloney
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
chisholmd earned 2000 total points
ID: 16829459
Since you have not yet received any comments about shelling out for this task how about using a freware Zip/UnZip componant?

http://www.xstandard.com/page.asp?p=C9891D8A-5390-44ED-BC60-2267ED6763A7&ss=D6DD5252-781D-47AE-900A-29F56BB7DFFE

(Yes, They have annoyingly long URLs)



0
 

Author Comment

by:hmaloney
ID: 16830105
Fantastic.  That did the trick perfectly.  You're a gem.
0
 
LVL 7

Expert Comment

by:chisholmd
ID: 16830145
Thanks, glad to hear it works.

 
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question