ASP run command line

S

shank

What is the proper syntax to run this command line in ASP?

wzzip.exe File.zip File.txt

thanks
 
R

Ray Costanzo [MVP]

Dim oShell, sCommand
sCommand = "wzzip.exe C:\Output\File.zip C:\SourceFiles\File.txt"
Set oShell = Server.CreateObject("WScript.Shell")
oShell.Run sCommand, , True
Set oShell = Nothing

Try that.

Ray at work
 
S

shank

I'm not sure if this is a syntax issue or a WinZip issue. The code runs
without error and these three files are created. The temp files are
populated, but the ZIP file is empty. Any ideas?

_Za04560 = 3,321 KB
Stock.zip = 0 bytes
WZ60.tmp = 3,321 KB

If I use the START > Run - this command works without a probolem:
wzzip.exe C:\Inetpub\wwwroot\shwholesale\db\shStock.zip
C:\Inetpub\wwwroot\shwholesale\db\*.dbf
So that should tell me the command and paths are OK.

<%
Dim oShell, sCommand
'sCommand = "wzzip.exe C:\Inetpub\wwwroot\shwholesale\db\shStock.zip
C:\Inetpub\wwwroot\shwholesale\db\*.dbf"
sCommand = "wzzip.exe C:\Inetpub\wwwroot\shwholesale\db\shStock.zip
C:\Inetpub\wwwroot\shwholesale\db\*.dbf"
Set oShell = Server.CreateObject("WScript.Shell")
oShell.Run sCommand, , True
Set oShell = Nothing
%>
thanks!
 
R

Ray Costanzo [MVP]

Are those .dbf files in use by your page when you execute that script? Any
open database connections or anything? Throw some test text files in that
directory and try zipping those up to see what happens.

Ray at work
 
S

shank

Yes they are DBF files, but there is no connection to them. They are just
simple files. I can zip using the RUN dialog box with the below command, but
when I stick the command in the code, all I get is the temp files and an
empty zip file.
thanks!
 
R

Ray Costanzo [MVP]

You explained that in your previous post. Did you try testing it with text
files?

Ray at work
 
S

shank

I just tried it with 5 *.txt files. Same results. Two temp files that are
populated and a ZIP file that's empty. Then I ran the command line in the
RUN dialog and it grabbed all 5 text files and zipped them without a
problem. So, same results.

oShell.Run sCommand, , True
What does the empty space between the commas mean?
What does True mean?

thanks!
 
R

Ray Costanzo [MVP]

Hi shank,

The empty space should actually be a 0, although a space is okay to use.
But, to be clear, best put a 0 in there. The true means that the script
should wait for your executed command to finish before moving along.
Download the WSH documentation here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9

When I run the script in a .vbs file, it works fine. It also works in an
ASP file where my IUSR account has full permissions on the directory in to
which I'm writing the .zip file.

My VBS file that I run:
Dim oShell, sCommand
sCommand = "wzzip.exe C:\Output\File.zip C:\SourceFiles\*.txt"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCommand, , True
Set oShell = Nothing

My ASP file:
<%
Dim oShell, sCommand
sCommand = "wzzip.exe C:\Output\File.zip C:\SourceFiles\*.txt"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCommand, , True
Set oShell = Nothing
%>

I'm using Winzip 10. Is your copy of Winzip registered?

Ray at work

As for your script, what kind of permissions does IUSR_[servername] have on
the directory you're trying to zip your files in?
 
S

shank

Yes I have the registered WinZip Pro version $59.99.
My permissions look right and I have to assume they are correct.
I can write the DBF files from one ASP page.
Then the ASP zip page creates the temp zip files.
That should cover read & writes.
I need to trade a few emails with WinZip I think.
thanks!


Ray Costanzo said:
Hi shank,

The empty space should actually be a 0, although a space is okay to use.
But, to be clear, best put a 0 in there. The true means that the script
should wait for your executed command to finish before moving along.
Download the WSH documentation here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9

When I run the script in a .vbs file, it works fine. It also works in an
ASP file where my IUSR account has full permissions on the directory in to
which I'm writing the .zip file.

My VBS file that I run:
Dim oShell, sCommand
sCommand = "wzzip.exe C:\Output\File.zip C:\SourceFiles\*.txt"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCommand, , True
Set oShell = Nothing

My ASP file:
<%
Dim oShell, sCommand
sCommand = "wzzip.exe C:\Output\File.zip C:\SourceFiles\*.txt"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCommand, , True
Set oShell = Nothing
%>

I'm using Winzip 10. Is your copy of Winzip registered?

Ray at work

As for your script, what kind of permissions does IUSR_[servername] have
on the directory you're trying to zip your files in?
shank said:
I just tried it with 5 *.txt files. Same results. Two temp files that are
populated and a ZIP file that's empty. Then I ran the command line in the
RUN dialog and it grabbed all 5 text files and zipped them without a
problem. So, same results.

oShell.Run sCommand, , True
What does the empty space between the commas mean?
What does True mean?

thanks!
 
S

shank

I have found the problem. The WinZip is user based registration, not server
based. They do not have a server version. It worked with the RUN box because
I was logged in.
thanks for your help!

- - - - - - - - - - -


Ray Costanzo said:
Hi shank,

The empty space should actually be a 0, although a space is okay to use.
But, to be clear, best put a 0 in there. The true means that the script
should wait for your executed command to finish before moving along.
Download the WSH documentation here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9

When I run the script in a .vbs file, it works fine. It also works in an
ASP file where my IUSR account has full permissions on the directory in to
which I'm writing the .zip file.

My VBS file that I run:
Dim oShell, sCommand
sCommand = "wzzip.exe C:\Output\File.zip C:\SourceFiles\*.txt"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCommand, , True
Set oShell = Nothing

My ASP file:
<%
Dim oShell, sCommand
sCommand = "wzzip.exe C:\Output\File.zip C:\SourceFiles\*.txt"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCommand, , True
Set oShell = Nothing
%>

I'm using Winzip 10. Is your copy of Winzip registered?

Ray at work

As for your script, what kind of permissions does IUSR_[servername] have
on the directory you're trying to zip your files in?
shank said:
I just tried it with 5 *.txt files. Same results. Two temp files that are
populated and a ZIP file that's empty. Then I ran the command line in the
RUN dialog and it grabbed all 5 text files and zipped them without a
problem. So, same results.

oShell.Run sCommand, , True
What does the empty space between the commas mean?
What does True mean?

thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top