Windows CMD, show the current folder name at prompt dynamically like Bash

Posted by guneysus on Super User See other posts from Super User or by guneysus
Published on 2013-11-04T14:29:22Z Indexed on 2013/11/11 10:02 UTC
Read the original article Hit count: 75

Filed under:
|
|

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,'"

© Super User or respective owner

Related posts about command-line

Related posts about prompt