0

I have installed UnZip so I can extract files by running batch files, I added the bin folder to both PATH (user variables) and Path (system variables), but I still have the following problem:

I created this batch file and saved it as a .cmd file:

unzip
timeout /t 10 /nobreak

If I place the file in any folder on my computer and double click it, I get this message:

'unzip' is not recognized as an internal or external command,
operable program or batch file

If I right-click it and choose Run as administrator, then the batch file is run and unzip is recognized.

Then, it happened that I moved the same file on the Desktop, double click and it worked. I tried moving the file around in different locations, but I still can't get it working. So I have to either keep it on desktop or run it as administrator.

I am running Windows 8.1.

How can I make it run normally (non-administrator) without having to keep it on the desktop?

Output from echo %path% in a cmd shell:

C:\bin\emsdk;C:\bin\emsdk\mingw\4.6.2_32bit;C:\bin\emsdk\clang\e1.34.1_64bit;C:\bin\emsdk\node\0.12.2_64bit;C:\bin\emsdk\python\2.7.5.3_64bit;C:\bin\emsdk\emscripten\1.34.1;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Windows\CCM;C:\bin\git\bin\;C:\bin\Git\cmd;C:\Program Files (x86)\Brackets\command;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Users\I323547\AppData\Local\Programs\Python\Python35-32\Scripts\;C:\Users\I323547\AppData\Local\Programs\Python\Python35-32\;C:\Users\I323547\AppData\Roaming\npm;C:\program files\apache-maven-3.3.9\bin;C:\Users\I323547\AppData\Local\atom\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\nodejs\;C:\Program Files (x86)\GnuWin32\bin;C:\Users\I323547\AppData\Local\Programs\Python\Python35-32\Scripts\;C:\Users\I323547\AppData\Local\Programs\Python\Python35-32\;C:\program files\apache-maven-3.3.9\bin;C:\bin;C:\Users\I323547\AppData\Roaming\npm;C:\Program Files (x86)\GnuWin32\bin; 

The unzip.exe live in this folder which path knows about:

C:\Program Files (x86)\GnuWin32\bin;
Roco CTZ
  • 101
  • 3
  • Add it to your PATH. – DavidPostill Mar 10 '16 at 00:12
  • But I have added it already to both Path (system variables) and also to PATH (user variables). And why is it working from Desktop and not from any other location? – Roco CTZ Mar 10 '16 at 20:31
  • Please [edit] and include the output from `path` in a `cmd` shell. – DavidPostill Mar 10 '16 at 20:33
  • Please put it on one line with no editing. – DavidPostill Mar 10 '16 at 20:55
  • I would start by 1/ removing the blank space at the end of the path (you shouldn't have `; ` in a path). 2/ Removing all the duplicate entries. You only need stuff in user **or** system **not** both. You have a lot of stuff in there twice. – DavidPostill Mar 10 '16 at 21:11
  • I'm not sure how to solve the "run as administrator problem" nor why it exists, but the workaround I've used before is to create it as a scheduled task (without a schedule) and give that task administrator access (you only need to do this once), then create a batch file that calls that scheduled task. That way, you don't need to keep giving it administrator access. – Wizongod Mar 12 '16 at 12:57
  • I would guess it is a problem with the associated program for the extension .cmd. You can configure it per user. Could you try to execute the script in a cmd.exe instead of a double click? What is the result? Wath was the path variable? what is the result of `assoc .cmd`? – Mayra Delgado Jan 30 '19 at 12:10

0 Answers0