]]>Taking User Input at DOS Prompthttp://www.shnenglu.com/Hero/archive/2010/11/25/134590.htmlHeroHeroThu, 25 Nov 2010 01:31:00 GMThttp://www.shnenglu.com/Hero/archive/2010/11/25/134590.htmlhttp://www.shnenglu.com/Hero/comments/134590.htmlhttp://www.shnenglu.com/Hero/archive/2010/11/25/134590.html#Feedback0http://www.shnenglu.com/Hero/comments/commentRss/134590.htmlhttp://www.shnenglu.com/Hero/services/trackbacks/134590.html
Taking User Input at DOS Prompt It is a very simple way to get the user input at the DOS prompt. You need to use the SET command with a variable name forthis purpose.
SET Command (syntax) Collapse | Copy Code SET /P <var>=[<prompt message>]
Example Collapse | Copy Code @ECHO OFFSET /P uname=Please enter your name: IF "%uname%"=="" GOTO Error ECHO Hello %uname%, Welcome to DOS inputs! GOTO End :Error ECHO You did not enter your name! Bye bye!! :End
Points of Interest The word "uname"in the above script is the variable that captures the user input. The above script also shows the validation whether any input is given or not. Use GOTO and Labels to control the flow.
]]>call鍜実oto鐨勫紓鍚岀偣http://www.shnenglu.com/Hero/archive/2010/01/04/104749.htmlHeroHeroMon, 04 Jan 2010 03:13:00 GMThttp://www.shnenglu.com/Hero/archive/2010/01/04/104749.htmlhttp://www.shnenglu.com/Hero/comments/104749.htmlhttp://www.shnenglu.com/Hero/archive/2010/01/04/104749.html#Feedback0http://www.shnenglu.com/Hero/comments/commentRss/104749.htmlhttp://www.shnenglu.com/Hero/services/trackbacks/104749.htmlCODE:[Copy to clipboard]