Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed 7-zip and add its directory to system path: C:\Program Files\7-Zip to PATH, from windows start->input cmd and press enter, Windows command line is started, i type 7z.exe, then press enter, it just run.

However when i start command line this way:

cmd.exe /c start cmd.exe

then i type 7z.exe, it gives me error because it can not find 7z.exe. why and how to fix?

P.S. 1. I'm on Win7. 2. For some other apps, the above way did works, that's why i'm so confused how bat works.

share|improve this question
1  
What's the bin path? Aren't you missing some quotes? –  Luiz Angelo Dec 5 '12 at 10:23
    
i updated my question to let it more specific. –  July Dec 5 '12 at 11:08
    
Your command line command seems strange. Why start? Why the "cmd /k" at the end? What are you really trying to accomplish? Try without the extra stuff. –  Luiz Angelo Dec 5 '12 at 11:21
    
OK, extra stuff removed, see my edit above. –  July Dec 5 '12 at 11:33
add comment

2 Answers

up vote 1 down vote accepted

There are two PATHs on Windows. The user and the system.

Which one have you altered? When it doesn't work, try "ECHO %PATH%" and see if "C:\Program Files\7-zip" is there. Try running manually.

Anyway, your command is strange. It is cmd calling (and closing afterwards) start. Start calls cmd.exe again with the /K switch. The /k Switch has something to do with quotes, but I don't get it. Why do you need the sequence cmd -> start -> cmd?

share|improve this answer
    
Thanks for your comment, i did set the folder to PATH however i run "echo %path%", "C:\Program Files\7-zip" is not there. it's strange. –  July Dec 5 '12 at 12:04
    
My guess then is that you've added the "C:\Program Files\7-zip" to a user path. And that this command chaining of yours dumps you in a different security context where you can't the original path. Which you see in you just type cmd. Change the system path and see if that works. –  Luiz Angelo Dec 5 '12 at 12:08
    
Just now I restart my computer and now it works, Windows does not prompt me with a restart when i modify the PATH. What i would like to use the cmd is, i'd like to start it to a definite directory, so command like cmd /c start "title" /D "D:\mydir" cmd.exe /K will start cmd at D:\mydir. Thanks for your ideas and patience. –  July Dec 5 '12 at 12:31
    
cmd /k "folder" is enough. Source: stackoverflow.com/questions/60904/… –  Luiz Angelo Dec 5 '12 at 13:25
add comment

If you simply added bin to your PATH, not a complete path like C:\Users\July\bin, then if you type xx, cmd.exe will try to resolve that as the relative path bin\xx.exe, meaning it will look in bin subdirectory of the current directory. I suspect that's not what you expected.

share|improve this answer
    
Thanks for your input, yes i added the complete path to PATH –  July Dec 5 '12 at 8:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.