Subscribe to Windows IT Pro
June 29, 2000 12:00 AM

JSI Tip 2545. How can I get a batch file to prompt me for parameters in Windows 2000?

Windows IT Pro
InstantDoc ID #73865
Rating: (1)


In Windows NT, we had to use tip 0323 to accomplish this.

In windows 2000, you can use the

SET /P variable=[promptString]

"The /P switch allows you to set the value of a variable to a line of input
entered by the user.  Displays the specified promptString before reading
the line of input.  The promptString can be empty."
Here is a silly little example:
@echo off
setlocal
set OK=N
:again
set /p user=Please enter your User Name or END.     
if /i [%user%]

[END] endlocal&goto end if [%user%]

[] goto again for /f "Tokens=*" %%i in ('net user "%user%" /domain') do call :parse "%%i" If "%OK%"

"N" goto again set /p xxx=Press any key to exit. endlocal goto end :parse set ustr=%1 if not "%ustr:~1,9%"

"Full Name" goto end set ustr=%ustr:"=% set ustr=%ustr:Full Name =% @echo Thank you %ustr% set OK=Y :end

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.