Hide keyboard input in a batchfile - windows

I am writing a command line code to perform some operations which require a password from the user.I am reading the password from cmd using set/p "pass=>" .
But while using this the password being typed is displayed. I do not want it to be displayed on the cmd window. what modification should i make?

I think CMD does not work in this way. i am guessing you have some sort of a if statement on the inside that will start to run the rest of the program if your input is right. batch files is just a way to get your daily operations faster :)
clsafter "password" typed will prevent people from seeing the password after it was entered.
or maybe this post can help you:
Can I mask an input text in a bat file

Related

Is it possible to enter password for SecurePad plugin in Notepad++ using Windows cmd? [edited]

I initially planned on making a program that amends a text file which contains valuable data, based on arguments passed from cmd. However, if the text file is left in the open, it kind of negates the use of the program. I know I can use some file encryption tool, but since I would pass command line arguments to the program, it would be easier if I could first decrypt the text from cmd. Is there a method to do so?

what is the command prompt equivalent of CTRL+Z?

i have an excel macro which renames all the files in a folder with a user provided string.
if the user enters a wrong input i have to undo the file rename.
im using cmd to rename the files.
please let me know how to run CTRL+Z using cmd
Standard keyboards send dedicated characters when a user presses ctrl+a, ctrl+f, ctrl+c, ctrl+z, etc., based on what application the user is in. It heavily depends on that.
That way, when in an editor application for example, if the ctrl+z is pressed a character code is send, which is called the Substitute character, represented as 0x1A.
Look at the ascii table, Or read it here, on Substitute Character wiki
Although, on Command line, there is no 'undo', so find another way.

Custom Input For Command Prompt?

What I'm looking for seems to be very simple. I want to run a command prompt line, but have it to be easily editable for anyone to use. There are multiple commands to this script, but only one part needs to be changed, and asks the user for a custom input. I'm sure this is already online, however after looking for hours and finding nothing as I have no clue what it would even be called, this is my last resort. Any help would be appreciated as I'm not even quite sure how to describe this.
Your question is a bit vague but if I understand correctly it sounds like you are trying to read user input (ie. prompt the user for input) from a batch file. If so, this should work for you:
set /p CustomInput="Please enter blah blah blah.."
Then you can use %CustomInput% as a variable in the script.
I guess you may also add this line:
goto %CustomInput%

Interact with console program via batch script

I want to start a console program via batch script. Starting the console program works fine. I am starting it via call xxx.exe para para. The problem is that the console program wants an input like that after it is started.
call xxx.exe para para
please type in password:_
Is it possible to make the input of the password from the batch script.
Whether you are using batch or bash, as it seemed originally, you could try this simple piping:
echo YourPassword| program.exe parameters...
Note that if it is indeed a batch script, it is vital to make sure there's no extra space between your password and the |, or it will be passed along with the password, as part of the password. In bash, if I'm not much mistaken, such a space would be disregarded (or maybe it would only be so if you enclosed the echoed string in quotation marks, I'm not entirely sure).
Anyway, the above doesn't always work, as some programs implement password reading in a way that disregards the input stream piped from another command.
You tagged your question "Windows" and "Batch" and asked about "batch" in the question. The answer to that question is: Yes, use set like this:
set /p password=please type in password:
If you're really asking about 'bash' shell, you should re-tag your question (and change the text).

Get user input while still typing (in a terminal app)

I want to read user input from STDIN and process the preliminary input while the user is still typing.
A previous answer has some ruby code which enables this behaviour.
How to get a single character without pressing enter?
I would suggest reading something like http://ruby.runpaint.org/io
Call STDIN.getc to get individual characters that the user types.

Resources