Using wshell to run a .bat file

Posted on 2006-06-04
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("")
set proc = wshell.exec("%comspec% /c 7za a -tzip 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.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") "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!

Question by:hmaloney
    LVL 7

    Accepted Solution

    Since you have not yet received any comments about shelling out for this task how about using a freware Zip/UnZip componant?

    (Yes, They have annoyingly long URLs)


    Author Comment

    Fantastic.  That did the trick perfectly.  You're a gem.
    LVL 7

    Expert Comment

    Thanks, glad to hear it works.


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
    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…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now