Input for .bat files - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: Input for .bat files (/showthread.php?tid=40520) Input for .bat files by Vilkku on 03-18-2005 at 08:32 PM
Quick queston, I doubt this is possible. code: RE: Input for .bat files by segosa on 03-18-2005 at 11:04 PM I believe %1, %2, etc refers to each word in the commandline parameters of the .bat file. RE: Input for .bat files by CookieRevised on 03-19-2005 at 12:00 AM
some commands which can be usefull (type them in dos with /? behind them and you'll see the explainations):
First example: @echo off if "%1"=="" ( set /p choice=Choose a number: ) else ( set choice=%1 ) echo net send abc%choice% Hello set choice= Second example: - shorter example of the first @echo off set choice=%1 if "%choice%"=="" set /p choice=Choose a number: echo net send abc%choice% Hello set choice= Third example: - variant of the second example: - if user didn't type a number the question is asked again @echo off set choice=%1 :CheckNumber if "%choice%"=="" set /p choice=Choose a number: if "%choice%"=="" goto CheckNumber echo net send abc%choice% Hello set choice= Fourth example: - other version of the third example @echo off set choice=%1 :CheckNumber if "%choice%"=="" ( set /p choice=Choose a number: goto CheckNumber ) echo net send abc%choice% Hello set choice= Fifth example: - the program will quit when enter is pressed without typing a number @echo off set choice=%1 if "%choice%"=="" set /p choice=Choose a number: if not "%choice%"=="" echo net send abc%choice% Hello set choice= RE: Input for .bat files by lopardo on 03-19-2005 at 03:09 AM Really good page about batch files: http://www.robvanderwoude.com/ RE: Input for .bat files by Vilkku on 04-07-2005 at 10:54 AM
Thank you all <3 |