views:

5271

answers:

5

How do I find the local path on windows in a command prompt?

+7  A: 

It is cd for "current directory".

Daniel A. White
If you need it in a variable or so, using the %CD% pseudo-variable is probably easier.
Joey
+15  A: 

this prints it in the conslole echo %cd%

Petar Kabashki
+1  A: 

hmm - pwd works for me on Vista...

Final EDIT: it works for me on Vista because WinAvr installed pwd.exe and added \Program Files\WinAvr\Utils\bin to my path.

sean e
Doesn't work on WinXP or Win2003
Joshua
Nor vista. Are you using powershell?
Daniel A. White
Nor Windows 7 ;)
Baversjo
I'm not using powershell. I seem to recall something about command extensions but can't find a checkbox anywhere for that. I've also got <tab> completion in my Command Prompt. I could swear there used to be an applet in Control Panel to enable command extensions but I can't find it now.
sean e
Command extensions are enabled by default on Windows NT and later. Tab completion is separate from that and was available from Windows 2000 onwards and enabled by default since XP. pwd only works here because I have a pwd.cmd with "echo %cd%" in my path. You can use gcm pwd in Powershell to check where it comes from on your machine (sort of like which(1), only better).
Joey
gcm pwd reports that pwd is an Alias with a definition of Get-Location.
sean e
A: 

dir | find "Directory"

+1  A: 

C:\Documents and Settings\Scripter>echo %cd% C:\Documents and Settings\Scripter

C:\Documents and Settings\Scripter>

for unix use pwd command

Current working directory