Lost Password?

Go Back   CodeCall Programming Forum > Software Development > General Programming

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-27-2007, 01:16 PM
Magnus_L Magnus_L is offline
Newbie
 
Join Date: Nov 2007
Posts: 2
Credits: 0
Rep Power: 0
Magnus_L is on a distinguished road
Default Batch Programming Question

There is this command which i know exist but which i can't find.

Let's say that i want to make a batch file which shows a menu when i open it. The menu will look like about this:

Press 1 to show Systeminfo
Press 2 to to do a CHKDSK
Press 3 to show all the files in the current directory



Could anyone give me a code example? The thing I'm after is not how to simply show the menu, but I'm wondering how i can make the user choose the action.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 11-27-2007, 06:07 PM
Jordan's Avatar   
Jordan Jordan is online now
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 7,333
Last Blog:
Tramp Variables
Credits: 1
Rep Power: 20
Jordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud of
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

Code:
echo  Choice 
echo.
echo Press 1 to show Systeminfo
echo Press 2 to to do a CHKDSK
echo Press 3 to show all the files in the current directory
echo.
choice Your choice:
if errorlevel 3 goto do3
if errorlevel 2 goto do2
if errorlevel 1 goto do1
:do1
.... code here
:do2
etc...
This is untested but I believe correct.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
Don't hesitate to ask any questions that you have! Check out our ASCII Calculator!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-27-2007, 11:46 PM
v0id's Avatar   
v0id v0id is offline
Super Moderator
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,578
Last Blog:
CherryPy(thon)
Credits: 55
Rep Power: 28
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

There's other ways to get user input than Jordan's method (though, his is probably the best) You could look into set and choice.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch File Help ineedhelp General Programming 4 11-15-2007 07:04 PM
Dynamic programming help needed Wo Hu General Programming 2 10-11-2007 11:22 AM
Beginning Programming frank_l C and C++ 11 10-11-2007 02:23 AM


All times are GMT -5. The time now is 10:48 AM.

Contest Stats

Xav ........ 1323.18
MeTh0Dz|Reb0rn ........ 1053.7
morefood2001 ........ 879.43
John ........ 877.37
marwex89 ........ 869.98
WingedPanther ........ 834.24
Brandon W ........ 749.07
chili5 ........ 310.39
Steve.L ........ 241.84
dcs ........ 216.02

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 82%

Ads