You are using an out of date browser. It may not display this or other websites correctly. You should upgrade or use an alternative browser.
set command
About this tag
The set command in Windows batch scripting is used to assign values to variables, with set /p specifically capturing user input. Common issues include incorrect syntax, such as missing quotes around the prompt string or variable name, and confusion with command output redirection. For example, set /p variable=prompt expects the prompt to be enclosed in quotes if it contains spaces. Additionally, using set /p with a pipe to capture command output often fails because set /p reads from stdin, which may not be available. Troubleshooting involves verifying variable expansion with echo %variable% and ensuring proper quoting.
Hi!
I tried to send command output to variable.
I'm using is in Windows 10.1903 x64
I used syntax:
SET /P variable= | command
I used batch by context menu to get word, characters and lines count in text file using old WC tool (it's great).
First I used only copying output into clipboard by...
I'm trying to create a text-based game, but I can't get passed the menu because either "set /p" isn't taking an input, or "if '%...'" isn't seeing it. This is what I'm doing to test menus, currently
:mmenu
echo Main Menu
echo Start
echo Quit
SET /P "a=Select "
if "a"=="Start" [removed:then...