-
February 22nd, 2005, 07:50 PM
#1
Junior Member
bat programing
Ok my question is about how to take user input and use it for the program.
I am makeing a menu for a dos boot disk.
Here is a example of what I am trying to do.
Code:
@echo off
:begin
echo Welcome to chuckie's boot disk
Echo.
echo 1. Fdisk 2. Clean1k 3. Delpart 4. Format 5. fdisk
Echo.
echo 6. findram 7. move 8. chkdisk 9. debug 10. edit
Echo.
echo 11. scandisk 12.sys 13. mscdex 14. ext 15. attrib
Echo.
echo 16. restart 17. extract 18. help
echo Select What Program You Would Like To Run..
(user input) %1
cls
IF %1==1
Fdisk
IF %1==2
Clean1k
IF %1==3
Delpart
ETC...
IF %1==17
help.bat
goto error
REM This is for if the enter a incorrect number
:error
You did not enter a correct number. Hit any key to try agin
pause
cls
goto begin
Also is there a way to allow pass commands to the program?
Example:
At user promt
Be able to do like
4 c: /y
format c: /y
Thank you for any help you can give..
Its not are you paranoid, But are you paranoid enough
FTP server up someday I hope...
Freedom of information is Your right..
-
February 22nd, 2005, 08:10 PM
#2
akachuckie,
What you need is a reference to batch file programming. Can be found here:
http://www.computerhope.com/batch.htm
Basically, look up the CHOICE command, it will give you what you need.
Passing arguments is done like this:
test.bat arg1 arg2
in your batch file, arg1 is %1, arg2 is %2, and so on...
Hope this helps,
-ik
Alright Brain, you don\'t like me, and I don\'t like you. But let\'s just do this, and I can get back to killing you with beer.
-- Homer S.
-
February 22nd, 2005, 08:17 PM
#3
Junior Member
Yea thought about the Choice Command. But I really don't have room on the disk for it. It is a external command.
Is there any other way to do it?
Its not are you paranoid, But are you paranoid enough
FTP server up someday I hope...
Freedom of information is Your right..
-
February 22nd, 2005, 08:25 PM
#4
Well, I guess you could write a small C program that could do the same... I don't know of any other ways using batch files. Try googling it, I know as much as you do at this point...
Alright Brain, you don\'t like me, and I don\'t like you. But let\'s just do this, and I can get back to killing you with beer.
-- Homer S.
-
February 22nd, 2005, 09:15 PM
#5
Junior Member
I did find this. But all I can do is ECHO %INPUT%
Code:
@echo off
echo BATCH_INPUT___hgQX-PPP_XPPP E#HH0E50EG0Ef0Ehs>myinput.com
echo myinput.bat hoAX5@@PZYh@xX5@D3!r/P[WX,b,-PZh>>myinput.com
echo X3!X2ErP,{,{PYX4=0ErWX,j,-PZh@@X3!=set input>>myinput.com
ECHO.
ECHO.
ECHO.
echo INPUT:
myinput.com
call myinput.bat
echo.
echo.
del myinput.com
del myinput.bat
ECHO %INPUT%
Any idea's?
Its not are you paranoid, But are you paranoid enough
FTP server up someday I hope...
Freedom of information is Your right..
-
February 22nd, 2005, 09:50 PM
#6
Junior Member
I also tryed if staments and they did not work either.
hm...
what would dos call the variable named in c language?
Its not are you paranoid, But are you paranoid enough
FTP server up someday I hope...
Freedom of information is Your right..
-
February 22nd, 2005, 10:43 PM
#7
It's not exactly easy, but it can be done. I don't have the time to thoroughly check it out right now, but something like this should help you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|