Post by lexikos » 03 Jan 2015, 21:21
I have a hotkey to open up a command prompt for the active window. Since I use git quite a bit, it opens a git shell instead of cmd if it finds a git repository. But sometimes I don't want a git shell; I want cmd.exe.
So after typing win+r, cmd, enter and cd'ing to the copy-pasted path several times in one day, I had a random idea: in the address bar, prefix the current path with
cmd /k cd and hit enter. It worked. Somehow that seemed easier.
The second time around, I got a message "The directory name is invalid." What was even more odd was that the command prompt was at the right directory anyway. So I realized that I didn't even need the directory; when you type a command in the address bar, it uses the working directory of the folder you're looking at. So:
Press Alt+D, type cmd and press Enter.
I can't believe I never thought of that before. Now, I could make a hotkey to open cmd.exe, but it's still useful to know. (But Alt+D probably depends on the OS language.)
Later, I realized the reason for the error: when you run an exe from the address bar in Windows 7, the address bar's content changes to the full path of the exe.
I have a hotkey to open up a command prompt for the active window. Since I use git quite a bit, it opens a git shell instead of cmd if it finds a git repository. But sometimes I don't want a git shell; I want cmd.exe.
So after typing win+r, cmd, enter and cd'ing to the copy-pasted path several times in one day, I had a random idea: in the address bar, prefix the current path with [c]cmd /k cd[/c] and hit enter. It worked. Somehow that seemed easier.
The second time around, I got a message "The directory name is invalid." What was even more odd was that the command prompt was at the right directory anyway. So I realized that I didn't even need the directory; when you type a command in the address bar, it uses the working directory of the folder you're looking at. So:
[b]Press Alt+D, type [c]cmd[/c] and press Enter.[/b]
I can't believe I never thought of that before. Now, I could make a hotkey to open cmd.exe, but it's still useful to know. (But Alt+D probably depends on the OS language.)
Later, I realized the reason for the error: when you run an exe from the address bar in Windows 7, the address bar's content changes to the full path of the exe. :headwall: