Reputation: 171
My bat script (new.bat):
7z x –oC:\Users\Toshiba\Downloads\* C:\Users\Toshiba\Downloads\*.zip
del C:\Users\Toshiba\Downloads\*.zip
Despite using the command line version of 7zip, if i run my batch script, i get:
7z x ΓÇôoC:\Users\Toshiba\Downloads* C:\Users\Toshiba\Downloads*.zip '7z' is not recognized as an internal or external command, operable program or batch file.
del C:\Users\Toshiba\Downloads*.zip C:\Users\Toshiba\Downloads\XT1032_RETAIL-EU_4.4.4_KXB21.14-L1.40_36_cid7_CFC_1FF.xml.zip Access is denied.
Here are my instructions. It asks me to edit the PATH User variable under Enviromental variables, but as there wasn't one i created it like so:
Variable Name: Path
Variable Value:C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\7-Zip\;C:\Users\Toshiba\Documents\new.bat
Upvotes: 0
Views: 9423
Reputation: 73526
ΓÇô
in the error message means that instead of the hyphen -
you've used En dash.'7z' is not recognized
means either that it's not in a folder defined in PATH
variable or you have saved the batch file with a unicode signature (byte order mark).Access is denied
error may indicate the file is opened somewhere or maybe it has a readonly attribute which you can clear by adding attrib -r C:\Users\Toshiba\Downloads\*.zip
on a new line before del
.Solution: use the correct hyphen -, specify a full path for 7z
in quotes (for example, "C:\Program Files\7-Zip\7z.exe"
) and resave the file in plain encoding (ANSI in Windows Notepad, for example), not UTF-8, not UTF-16.
Upvotes: 1