Software Development

DOS – Change your command-line prompt

We can change our default DOS prompt in a command-line window. Sometimes we do not want people knowing the current path we work on or from which directory we invoke commands in a command-line window (DOS prompt). We can temporarily use the prompt command to hide it, which temporarily allows us to change the command prompt.

DOS is an ancient technology but remains a crucial part of the Microsoft Operating Systems. Nowadays, we refer to it as the Windows command-line or command-line window. It has its own unique set of commands allowing users to interact with Windows in a non-graphical way.

DOS is different from PowerShell, which has more capabilities.

Change from Our Default Prompt

Our default is to follow this format [drive]:\. For instance, we have this Windows command line screen.

19-11-2016-2-34-22-pm

There is nothing wrong with this. However, when we are in a particular directory, we may feel uncomfortable sharing an image (photo) of that screen. We may need to use a DOS command to change our command-line prompt. For example, your Windows user name may be visible on this image.

19-11-2016-2-37-35-pm

Another case is when you had changed to some other directory that contains confidential stuff.

DOS Change command-line prompt

Hide your DOS prompt in a command-line window

There is a simple trick in DOS by using the prompt command; we can hide our command prompt.

19-11-2016-2-48-44-pm

Even if we change to another directory, the new location will not be visible.

DOS Change command-line prompt

 

Loading

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like