127Views7Replies

Author Options:

Batch file help Answered

Picture of

Hello everybody I am starting to get into batch files and so on. I am trying to make a program that will copy different files depending on what the user wants. Would anybody know where I can find some good turituals or a ( free)program that will make the codes for me ? I need to Figure out how to make a menu. The options need to copy certain files from a floppy (a) to the desktop. Is there anyway for me to make shortcuts in a folder of all the shared folders without knowing there names ? Codes and links are much appreciated The below image is as far as I have gotten

7 Replies

user
Prof. Pickle (author)2012-12-15

Umm... Menus aren't exactly top-line code, they are more a bunch of echo codes, the real magic is in processing keystrokes.

echo Press the number corresponding to the option you want
echo 1) Option 1
echo 2) Option 2
echo 3) Option 3
choice /c 123 /n
cls
if %errorlevel% equ 1 echo You have pressed one
if %errorlevel% equ 2 echo You have pressed two
if %errorlevel% equ 3 echo You have pressed three
echo.
echo Press any key to exit
pause>nul


Do you see now?

Select as Best AnswerUndo Best Answer

user
Goodhart (author)2008-03-05

in batch, one of the best ways to create a menu, is to "print" one on the screen, and then scan for a key press (and of course, react to that keystroke in a branching manner).

Select as Best AnswerUndo Best Answer

user
littlechef37 (author)Goodhart2008-03-05

???? Remember your talking to a Batch Noob

Select as Best AnswerUndo Best Answer

user
Goodhart (author)littlechef372008-03-05

Well, I remember "the method", but it has been so long since I did anything in batch, that I would have to look up particulars on the actual commands. But to print on the screen, you can just use the Rem (remark) line Rem this is the title rem rem 1: first selection rem 2: second one and so on then put in a pause and after the pause read the keypress (which I don't remember off the top of my head how to do) and then a simple goto and exec.

Select as Best AnswerUndo Best Answer

user
zachninme (author)2008-03-05
I have no clue about windows, but this should get you close:
cp A:\* C:\Path\To\Desktop
...I think...

Select as Best AnswerUndo Best Answer

user
littlechef37 (author)zachninme2008-03-05

thanks no i need options.....

Select as Best AnswerUndo Best Answer

user

now* god I have go to watch my spelling

Select as Best AnswerUndo Best Answer