Why doesn't this Shell command work? 
Author Message
 Why doesn't this Shell command work?

I am trying to view the contents of a .ZIP file. I am using the following
code in attempt to do it but I seem to have problems with it.

What happens is that the screen turns black and then comes back to windows.
I then check to see if c:\compress.out contains the output but the file
does't even exist.

I verified that txtSourceFile.Text is a valid filename and that it exists
before this code is executed.  Also pkzip does recide in the dos dir.

Also if I try to execute the command without the > c:\compress.out at the
end it still doesn't show anything on the screen.

-------------------------------------------------------------------------

Sub Process_File ()
Dim DosCommand As String, X As Integer

DosCommand = "c:\dos\pkzip.exe -v " & txtSourceFile.Text & " > c:\compress.out"
X = Shell(DosCommand, 1)

End Sub
----------------------------------------------------------------------------

IF someone can figure out whats wrong with this or maybe if there exists a
VBX or DLL function that can do this for me Is appreciate it.

Thanks,

****************************************************************************
Ed Hernandez                                 North Broward Hospital District
Interface Programmer                         1608 Andrews Ave.


***************************************************************************

--
****************************************************************************
Ed Hernandez                                 North Broward Hospital District
Interface Programmer                         1608 Andrews Ave.


***************************************************************************



Thu, 28 Aug 1997 08:48:57 GMT  
 Why doesn't this Shell command work?

Quote:

> I am trying to view the contents of a .ZIP file. I am using the following
> code in attempt to do it but I seem to have problems with it.

> What happens is that the screen turns black and then comes back to windows.
> I then check to see if c:\compress.out contains the output but the file
> does't even exist.

> I verified that txtSourceFile.Text is a valid filename and that it exists
> before this code is executed.  Also pkzip does recide in the dos dir.

> Also if I try to execute the command without the > c:\compress.out at the
> end it still doesn't show anything on the screen.

> -------------------------------------------------------------------------

> Sub Process_File ()
> Dim DosCommand As String, X As Integer

> DosCommand = "c:\dos\pkzip.exe -v " & txtSourceFile.Text & " > c:\compress.out"
> X = Shell(DosCommand, 1)

> End Sub
> ----------------------------------------------------------------------------

> IF someone can figure out whats wrong with this or maybe if there exists a
> VBX or DLL function that can do this for me Is appreciate it.

> Thanks,

> ****************************************************************************
> Ed Hernandez                                 North Broward Hospital District
> Interface Programmer                         1608 Andrews Ave.


> ***************************************************************************

> --
> ****************************************************************************
> Ed Hernandez                                 North Broward Hospital District
> Interface Programmer                         1608 Andrews Ave.


> ***************************************************************************

well, to the best of my recollection to use the ">" operator you have to
shell COMMAND.COM /c then your command line.
i.e
 rc = Shell ("Command.com PKZIP -V file.zip > c:\t,t",1)

Does your file that you want to unzip reside in the current directory when
you shell ?



Thu, 28 Aug 1997 10:49:58 GMT  
 Why doesn't this Shell command work?

Quote:
>What happens is that the screen turns black and then comes back to
windows. I  
>then check to see if c:\compress.out contains the output but the file
does't  
>even exist.

>Sub Process_File ()
>Dim DosCommand As String, X As Integer

>DosCommand = "c:\dos\pkzip.exe -v " & txtSourceFile.Text & " >
c:\compress.out"  
>X = Shell(DosCommand, 1)

>End Sub

>IF someone can figure out whats wrong with this or maybe if there exists a
VBX  
>or DLL function that can do this for me Is appreciate it.

At first glance, it _should_ work.  Of course, people say that programmers
always give non-committal statements like that ("...so the changes we made
should work just fine.  You shouldn't have any more problems.").

What could be happening is that it may be executing fine, but when the DOS
.EXE command ends, Windows closes the DOS session/window immediately, so
you don't get to see it at all.  You may have to write a batch file that
has a PAUSE command in it, to wait for user input.

I don't know why the output direction doesn't work.  Try directing the
output to c:\compress.out from the DOS command line and see if that works.
PKZIP may not support that (I don't know and am too lazy to check for
myself).

Also, your machine/windows configuration may not be able to run that
particular DOS command without a .PIF to tell it how to execute it.  Try
setting up a .PIF and running that from the Shell() function.

Let me know how you fix it, if you don't mind.

Aaron Barbour



Thu, 28 Aug 1997 11:31:56 GMT  
 Why doesn't this Shell command work?

Quote:


>Subject: Why doesn't this Shell command work?
>Date: 12 Mar 1995 00:48:57 GMT
>I am trying to view the contents of a .ZIP file. I am using the following
>code in attempt to do it but I seem to have problems with it.
>What happens is that the screen turns black and then comes back to windows.
>I then check to see if c:\compress.out contains the output but the file
>does't even exist.
>I verified that txtSourceFile.Text is a valid filename and that it exists
>before this code is executed.  Also pkzip does recide in the dos dir.
>Also if I try to execute the command without the > c:\compress.out at the
>end it still doesn't show anything on the screen.
>-------------------------------------------------------------------------
>Sub Process_File ()
>Dim DosCommand As String, X As Integer
>DosCommand = "c:\dos\pkzip.exe -v " & txtSourceFile.Text & " > c:\compress.out"
>X = Shell(DosCommand, 1)
>End Sub
>----------------------------------------------------------------------------
>IF someone can figure out whats wrong with this or maybe if there exists a
>VBX or DLL function that can do this for me Is appreciate it.
>Thanks,

simple, use pkunzip -v, not pkzip -v

you're welcome



Thu, 28 Aug 1997 08:42:47 GMT  
 Why doesn't this Shell command work?
        The same thing happened in my program.  The reason you may be having problems with your code is because your try to load the output file before it is even there!!! :)  I know this sounds weird.  Let me explain.
mmand.  That's why you get a file not found error.
        The way I got around this was to make a loop - make sure you save your project before you try this!- checking whether the file is there or not.  If is NOT there, then make the loop continue.  If it's there continue on to the load statement.


Thu, 28 Aug 1997 14:50:13 GMT  
 Why doesn't this Shell command work?
        Another problem is that if the file is suppose to be in your app. dir. then make sure the path is set to:  app.path= "Blah_Blah" in your VB code.


Thu, 28 Aug 1997 14:53:19 GMT  
 Why doesn't this Shell command work?
        This is if you read 9105.  I have done this whole process before.  If you want to view the file -try an easier way.  Make a PIF, shell to it.  Have the PIF run the batch file.
        When the txt file is complete.  Input the file and list each line in the a list BOX control.
        *This way you can set the PIF file setting to run the batch window or iconized (or hidden if you use the WinExec API call)


Thu, 28 Aug 1997 15:02:25 GMT  
 Why doesn't this Shell command work?

Quote:
>>I am trying to view the contents of a .ZIP file. I am using the following
>>code in attempt to do it but I seem to have problems with it.

>>What happens is that the screen turns black and then comes back to
windows.
>>I then check to see if c:\compress.out contains the output but the file
>>does't even exist.

>>I verified that txtSourceFile.Text is a valid filename and that it exists
>>before this code is executed.  Also pkzip does recide in the dos dir.

>>Also if I try to execute the command without the > c:\compress.out at the
>>end it still doesn't show anything on the screen.

>>Sub Process_File ()
>>Dim DosCommand As String, X As Integer

>>DosCommand = "c:\dos\pkzip.exe -v " & txtSourceFile.Text & " >  
>c:\compress.out"
>>X = Shell(DosCommand, 1)

>>End Sub
>>----------------------------------------------------------------------------

>>IF someone can figure out whats wrong with this or maybe if there exists
a  
>>VBX or DLL function that can do this for me Is appreciate it.

>>Thanks,

>simple, use pkunzip -v, not pkzip -v

>you're welcome

_Either_ PKZIP or PKUNZIP should do this correctly.  See the documentation.

Aaron Barbour



Fri, 29 Aug 1997 04:23:26 GMT  
 Why doesn't this Shell command work?

Quote:

> I am trying to view the contents of a .ZIP file. I am using the following
> code in attempt to do it but I seem to have problems with it.

> [...]

> IF someone can figure out whats wrong with this or maybe if there exists a
> VBX or DLL function that can do this for me Is appreciate it.

> Thanks,

Hi!

Why don't you use the ZipInfo.VBX, which has been made for showing
detailled infos of .ZIP-Archives! (much more than names only!!!)

You will find it on any major VBX-FTP-Site, or eMail me!

                                               ciao, Dino



Fri, 29 Aug 1997 06:39:38 GMT  
 Why doesn't this Shell command work?

Quote:

>DosCommand = "c:\dos\pkzip.exe -v " & txtSourceFile.Text & " > c:\compress.out"
>X = Shell(DosCommand, 1)
>IF someone can figure out whats wrong with this or maybe if there exists a
>VBX or DLL function that can do this for me Is appreciate it.

You need to set up a new PIF file to run pkzip under windows.
Use the PIF editor that comes with windows, and search the help on
"PIFs, creating"

Hope this is some use.

Tom.

-----------------------------------------------------------------
Please reply to this e-mail with the name of the person you
wish to receive it on the subject line
(e.g. "FAO Jane Smith/..subject.."),
as this is a shared e-mail address.



Sat, 30 Aug 1997 18:00:46 GMT  
 Why doesn't this Shell command work?

Quote:

>>I am trying to view the contents of a .ZIP file. I am using the
following
>>code in attempt to do it but I seem to have problems with it.

>>-----------------------------------------------------------------------
--

>>Sub Process_File ()
>>Dim DosCommand As String, X As Integer

>>DosCommand = "c:\dos\pkzip.exe -v " & txtSourceFile.Text & " >
c:\compress.out"
>>X = Shell(DosCommand, 1)

>>End Sub
>>-----------------------------------------------------------------------
-----

>simple, use pkunzip -v, not pkzip -v

>you're welcome

Wrong.  He's using the correct command.  It's pkZIP -v, not pkUNZIP.  

--
**********************************************************
 Up At Six Aviaries, 1995
 Fax: 1-505-864-7299

 Author of "Bird Basics!" ~~~~Ask for a free demo copy
 Other custom animal software available...
**********************************************************



Sun, 31 Aug 1997 20:53:03 GMT  
 Why doesn't this Shell command work?

Quote:

>>>DosCommand = "c:\dos\pkzip.exe -v " & txtSourceFile.Text & " >
>>simple, use pkunzip -v, not pkzip -v

>>you're welcome
>Wrong.  He's using the correct command.  It's pkZIP -v, not pkUNZIP.  

Wrong. Both PKZIP and PKUNZIP support the -v option.

I think in older versions (eg 1.1) PKZIP did not have the option; PKUNZIP did.




Sun, 31 Aug 1997 22:35:13 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. shell - why doesn't this work

2. Shell command doesn't work under WinNT

3. Why oh why doesn't this work?

4. Why LoadPicture() works on local pathes and doesn't work on the URLS

5. WScript.Shell Run Doesn't Work???

6. Wscript.shell Run doesn't work

7. Shelling .HTM under NT Doesn't Work

8. Code doesn't work, why?

9. Why doesn't this MAPISendMail work?

10. Why doesn't this button work?

11. SQL in VB doesn't work - why?

12. Why doesn't this work?

 

 
Powered by phpBB® Forum Software