Windows – Hide what I type into Command Prompt

command linewindows

Some commands require putting in the password as one of the arguments (like net use, for example). Is it possible to run a command or change a setting in Command Prompt so that whatever I am typing does not show up on the screen? I basically want to type something without seeing what I'm typing and then press enter and have the command execute (the output can show).

Note that this is NOT for a batch file.

Best Answer

Use an asterisk (*) instead of your password in net use

In Microsoft Technet we read:

Net use

...

Password: Specifies the password needed to access the shared resource. Type an asterisk (*) to produce a prompt for the password. The password is not displayed when you type it at the password prompt.

So, just use * (a single asterisk) instead of your password in the command line, and then you will be prompted to type your password and it is not displayed on the screen.

https://technet.microsoft.com/en-us/library/bb490717.aspx


Other possible use cases:

There may be other use cases rather than net use, so this is a general answer to the question:

Please note that you should assume that there is usually no way to completely hide what you are typing from everyone, and these are some tricks to hide it from the curious people who stare at your monitor!

Solution 1: Changing color

One solution is changing the foreground color to black on a black background. You can not do this in command line by issuing the command color 00 because it returns error when you try to use the same color for both the foreground and the bacground. So, do this using properties of the command prompt window

Command prompt properties

After typing your command, this command will change back to original using this command:

color 07

or this

color /t

Note: You should clear screen before returning back to the original color using

cls
Related Question