Link to home
Start Free TrialLog in
Avatar of MacNuttin
MacNuttinFlag for United States of America

asked on

Batch file add a parameter

my batch file:ungz.bat
c:\share\pacl\paext -p"c:\share\archive" c:\share\winzip100.exe.gz
del c:\share\winzip100.exe.gz

I call it with CMD c:\share\ungz.bat

I want to pass it a filename:

call it with CMD c:\share\unzip.bat myfile.gz

and have it do this:
c:\share\pacl\paext -p"c:\share\archive" c:\share\myfile.gz
del c:\share\mfile.gz
ASKER CERTIFIED SOLUTION
Avatar of guidway
guidway
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
%1 would be the first parameter of a batch file, %2 is the 2nd, etc.

So if I understand your question, I think you want your batch file to be:
c:\share\pacl\paext -p"c:\share\archive" %1
del %1
Avatar of MacNuttin

ASKER


so this?

@echo off
   ::ungz.bat
   ::Usage command [command parameters]
   REM This script decompresses gz files and puts them in the achive
   c:\share\pac\paext -p"c:\share\archive" %1
   del c:\share\ %1
   :EOF
that should work
problem with del path tried this and it does ok but I have pass it the filename with it's path

@echo off
   ::ungz.bat
   ::Usage command [command parameters]
   REM This script decompresses gz files and puts them in the achive
   c:\share\pacl\paext -p"c:\share\archive\" %1
   cd share
   del %1
   :EOF