|
Answer» How could I have the .bat file ask for the destination folder.
In this case I want the batch to copy a folder from my C:\ to my flash drive, but I will be using this batch on multiple computers, and the flash drive may be K:\ on one computer, but can easily CHANGE to I:\ on another. So how would I do that?
All computers Windows XPWith XP you're in luck. Use the set command to get input from the user.
Code: [Select]@echo off set /p var=Enter destination folder: xcopy sourcefolder %var%
HOPE this helps. 8-)
Of course you could be really clever, write a Windows script and have the script determine the drive letter of the flash drive. But we'll leave that for another day.Hey, thanks! Worked fantastic! But I just have a quick question... Why do you need the @ SYMBOL before the echo off? I did a search of the home page, and the syntax for the command, it said, was just ECHO [ON|OFF], and didn't talk about the @. Could you explain it to me?The @ prevents the command from being echoed to the console. You can prefix any command with @, but @echo off is a catchall for every command following the echo statement or until echo is turned back on.
8-)Oh neat! Thanks for the explaination . But now I have another question. Would that mean to turn the echo back on, I would need to do @echo on ?
I'm sorry that I have to ask, but currently my computer's in BEST Buy, and now I have to use linux. Ugh. Though it Does present an oppurtunity to learn some python! No. ECHO would be off, so the command "echo on" would not be shown anyway. It's only when the echo is already on that you need the @.
Best advice: Make a small .bat file and try it. That's how I made a good 15% of my batch discoveries.
|