On windows commandline, how do I get a dynamic prompt that tells me where in the filesystem I am?
- by guneysus
I am trying to modify my CMD, to show only current dir name dynamically
like:
Desktop $
When i switched the folder, it must be updated.
It is not required to be code in purely batch file, it may depend any external commands, cygwin bash, etc.
@echo off
set a=bash -c "pwd | sed 's,^\(.*/\)\?\([^/]*\),\2,'"
%a%
cmd
outputs
_test-et
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. Tüm haklari saklidir.
>>
But
>> prompt %a%
gives
bash -c "pwd | sed 's,^\(.*/\)\?\([^/]*\),\2,'"