i am trying to run a batch file that extracts only .jar files with 7z.exe
here is my code:
set location=%cd%
set filename=%location%\outputfolder
set unzip=%location\resources
cd %unzip%
7z e -o%filename% -ir!*.jar -y "%filename%\*.zip"
but it gives an exception: error: incorrect command line
so i removed the -ir!*.jar
and it then gives another error: error: cannot use absolute pathnames for this command
so i changed the -o%filename%
to -oC:\\outputfolder
and it works!!!!!!(here is my script now):
set location=%cd%
set filename=%location%\outputfolder
set unzip=%location\resources
cd %unzip%
7z e -oC:\outputfolder -y "%filename%\*.zip"
but i need these features
how fix?
try it with double quotes, %cd%
maybe has spaces:
7z e -o"%filename%" -i!*.jar -y "%filename%\*.zip"
Usage from the help screen:
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 Usage: 7za [...] [...] [] a: Add files to archive b: Benchmark d: Delete files from archive e: Extract files from archive (without using directory names) l: List contents of archive t: Test integrity of archive u: Update files to archive x: eXtract files with full paths -ai[r[-|0]]{@listfile|!wildcard}: Include archives -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives -bd: Disable percentage indicator -i[r[-|0]]{@listfile|!wildcard}: Include filenames -m{Parameters}: set compression Method -o{Directory}: set Output directory -p{Password}: set Password -r[-|0]: Recurse subdirectories -scs{UTF-8 | WIN | DOS}: set charset for list files -sfx[{name}]: Create SFX archive -si[{name}]: read data from stdin -slt: show technical information for l (List) command -so: write data to stdout -ssc[-]: set sensitive case mode -ssw: compress shared files -t{Type}: Set type of archive -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options -v{Size}[b|k|m|g]: Create volumes -w[{path}]: assign Work directory. Empty path means a temporary directory -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames -y: assume Yes on all queries
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.