Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.bashrc equivalent for windows cmd shell?

Tags:

shell

windows

cmd

Is there a .bashrc like file that Windows cmd shell reads on start-up?

I'd like to set a shorter prompt, the default prompt shows the full path to the current directory and it gets messy when I descend down several levels of sub-directories. Currently, I'm manually calling the PROMPT command whenever the displayed path gets too long. It'll be nice to set it automatically.

like image 463
DigitalEye Avatar asked Apr 23 '14 16:04

DigitalEye


People also ask

Is there a bashrc for command prompt?

For the cmd shell you need to create a . cmd file with whatever name you want (I called mine bashrc. cmd ) and place it somewhere in your filesystem where it isn't going to move around. I like to keep things organized in my Documents folder so mine is in %UserProfile%\Douments\Apps\cmd\bashrc.

Where can I find .bashrc file in Windows?

bashrc . For my Windows machine, that's /c/Users/Leonardo/. bashrc .

What is the equivalent of .bashrc in PowerShell?

As pointed out by Dai in the comment section, Powershell Profiles sound like the closest equivalent to the . bashrc file. A PowerShell profile is a script that runs when PowerShell starts. You can use the profile as a logon script to customize the environment.


1 Answers

As an alternative to SETX, you can create a batch file that will effectively act as .bashrc. Then create a registry key called AutoRun under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor and set the path to that file as a value.

like image 54
David Airapetyan Avatar answered Sep 28 '22 15:09

David Airapetyan