Computer Hope

Microsoft => Microsoft DOS => Topic started by: Google on August 10, 2006, 08:02:31 AM

Title: SET yourname?
Post by: Google on August 10, 2006, 08:02:31 AM
Is there some way I could have a batch file echo "type your name" and then in another part of the batchfile it would fill in thier name?:
Code: [Select]
@echo off
echo Type your name:
pause
Hi, %yourname%
???????????????????????????????????????????????????????????????????????????????????????????????????
Title: Re: SET yourname?
Post by: GuruGary on August 10, 2006, 08:46:05 AM
You can use this:
Code: [Select]
@echo off
set /p Name=Type your name:
echo Hi, %Name%
Title: Re: SET yourname?
Post by: Google on August 10, 2006, 10:20:35 AM
thanks, but wat does the /p do?
Title: Re: SET yourname?
Post by: Google on August 10, 2006, 10:55:07 AM
I also figured out this code:
Code: [Select]
@echo off
set /p g1=Type a girls name:
cls
set /p g2=Type another girls name:
cls
set /p g3=Type one more girls name:
cls
set /p b1=Type a boys name:
cls
set /p b2=Type another boys name:
cls
set /p b3=Type one more boys name:
cls
set /p l1=Type something you can do to a lemon:
cls
set /p l2=Type something else you can do to a lemon:
cls
set /p l3=Type one more thing you can do to a lemon:
cls
set /p bp1=Type a body part:
cls
set /p bp2=Type another body part:
cls
set /p bp3=Type one more body part:
cls
set /p p1=Type a place:
cls
set /p p2=Type another place:
cls
set /p p3=Type one more place:
pause
cls
echo  %b3% and %g2% are %l2%ing each others %bp3% in the %p2%!
pause
cls
echo %b1% and %g3% are %l3%ing each others %bp2% in the %p1%!
pause
cls
echo %b2% and %g1% are %l1%ing each others %bp1% in the %p3%!
pause
cls
echo hahahahahahahahahahahahahaha
pause
exit
Except how could I make it match up randomly like the highlighted area:
Code: [Select]
@echo off
set /p g1=Type a girls name:
cls
set /p g2=Type another girls name:
cls
set /p g3=Type one more girls name:
cls
set /p b1=Type a boys name:
cls
set /p b2=Type another boys name:
cls
set /p b3=Type one more boys name:
cls
set /p l1=Type something you can do to a lemon:
cls
set /p l2=Type something else you can do to a lemon:
cls
set /p l3=Type one more thing you can do to a lemon:
cls
set /p bp1=Type a body part:
cls
set /p bp2=Type another body part:
cls
set /p bp3=Type one more body part:
cls
set /p p1=Type a place:
cls
set /p p2=Type another place:
cls
set /p p3=Type one more place:
pause
cls
echo  %b3% and %g2% are %l2%ing each others %bp3% in the %p2%!
pause
cls
echo %b1% and %g3% are %l3%ing each others %bp2% in the %p1%!
pause
cls
echo [highlight]%b2% and %g1% are %l1%ing each others %bp1% in the %p3%![/highlight]pause
cls
echo hahahahahahahahahahahahahaha
pause
exit
How could I make it so that it's not always %b2%, %g1%, %l1% %bp1% and %p3% matching up with each other???