Shell Function 
Author Message
 Shell Function

Does anybody know how to pass a parameter to a batch file using the
Shell Function?  If I want to run PKZIP, I would want to pass the
filename to the command line in the batch file.

Thanks,

Steve

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Mon, 31 Mar 2003 10:31:59 GMT  
 Shell Function
Pass the parameter as part of the Shell string.
In the batch file, refer to it as %1, e.g.:
        xcopy %1 %2

Alternatively, you may be able to pass the parameters directly
to PkZip, e.g.:
lngDummy = Shell("c:\utils\pkzip -a c:\MyZip.zip c:\MySource.mdb", _
        vbMinimizedNoFocus)

Quote:

> Does anybody know how to pass a parameter to a batch file using the
> Shell Function?  If I want to run PKZIP, I would want to pass the
> filename to the command line in the batch file.

--
Perth, Western Australia
Tips for MS Access users at:
        http://odyssey.apana.org.au/~abrowne


Mon, 31 Mar 2003 11:46:39 GMT  
 Shell Function
I use the ShellAndWait function, which is available at either of the sites
below, as Shell is asynchronous, ie there is no guarantee that the commands
will finish before Access carries on with the next line of code:

http://www.mvps.org/access/api/api0004.htm
http://support.microsoft.com/support/kb/articles/Q178/1/16.asp

and then I can run PKZip like:

ExecCmd ("C:\PathtoPKZip\pkzip25 -add C:\PathtoZipFile\ZipFile.zip
C:\PathToDB\DBName.mdb")

--
Jon

http://www.applecore99.freeserve.co.uk


Quote:
> Does anybody know how to pass a parameter to a batch file using the
> Shell Function?  If I want to run PKZIP, I would want to pass the
> filename to the command line in the batch file.

> Thanks,

> Steve

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Mon, 31 Mar 2003 13:05:14 GMT  
 Shell Function
I ended up using the function you sent me to, Jon.  It worked perfectly
with no altering.  I looks like Microsoft liked it too.  Theirs is
identical.  The Access Web comes through again.

Thanks to both of you,

Steve



Quote:
> I use the ShellAndWait function, which is available at either of the
sites
> below, as Shell is asynchronous, ie there is no guarantee that the
commands
> will finish before Access carries on with the next line of code:

> http://www.mvps.org/access/api/api0004.htm
> http://support.microsoft.com/support/kb/articles/Q178/1/16.asp

> and then I can run PKZip like:

> ExecCmd ("C:\PathtoPKZip\pkzip25 -add C:\PathtoZipFile\ZipFile.zip
> C:\PathToDB\DBName.mdb")

> --
> Jon

> http://www.applecore99.freeserve.co.uk



> > Does anybody know how to pass a parameter to a batch file using the
> > Shell Function?  If I want to run PKZIP, I would want to pass the
> > filename to the command line in the batch file.

> > Thanks,

> > Steve

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Tue, 01 Apr 2003 11:11:47 GMT  
 Shell Function
Steve-
A method I use, albeit not as elegant as some others have pointed out is to
write your (.bat) batch files on the fly as in the example below, that way
you can develop all kinds of scenarios and change the .bat file accordingly:

 'write a batch file to copy the blank order.s files
      Open "c:\access\colonial\copyoc-s.bat" For Output As 1
      Print #1, "echo off"
      Print #1, "cls"

      WorkDir = "C:\ACCESS\COLONIAL\" & Plant

      Print #1, "CD " & WorkDir

      Print #1, "copy c:\access\colonial\order.sv8 order.8 /y >nul"
      Print #1, "copy c:\access\colonial\customer.sv8 customer.8 /y >nul"

      Print #1, "echo Creating    OrderS Diskette file for [ " & Plant &
" ]....."
      Print #1, "echo Creating CustomerS Diskette file for [ " & Plant &
" ]....."
      Print #1, "C:\ACCESS\COLONIAL\IMPS8 /U"
      Print #1, "COPY ORDER.8 A:\ /V /Y"
      Print #1, "COPY CUSTOMER.8 A:\ /V /Y"
      Print #1, "CD C:\ACCESS\COLONIAL"
      Close #1

      Call ShellWait("C:\access\colonial\copyoc-s.bat", 1)

      MsgBox "If No Noted Errors.... the OrderS, CustomerS File Creation &
Copy is Complete , when diskette drive light is out, click OK To Continue"

I also use this tek_neek to write remote access task files for Closeup and
other communication programs.
Bruce G


Quote:
> Does anybody know how to pass a parameter to a batch file using the
> Shell Function?  If I want to run PKZIP, I would want to pass the
> filename to the command line in the batch file.

> Thanks,

> Steve

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 02 Apr 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Shell Function not shelling under Windows NT.

2. The Shell Function

3. Shell function

4. Shell Function

5. Browsing for Printers using SHBrowseForFolder Shell Function

6. Problem using Shell Function with MS Wordpad

7. Shell Function and paths

8. shell function and output

9. Shell function

10. shell function problem

11. shell function probs

12. Shell Function

 

 
Powered by phpBB® Forum Software