Author Options:

Batch file help Answered

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


Prof. Pickle

5 years ago

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
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 Press any key to exit

Do you see now?


10 years ago

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).


Reply 10 years ago

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.


10 years ago

I have no clue about windows, but this should get you close:
cp A:\* C:\Path\To\Desktop
...I think...