I'm trying to build a windows batch file that will copy a folder and all its contents from the local user directory into an individually named folder on a shared server. The name of the folder on the server is something that the computer can't generate; I have to put it in manually according to various parameters.

My question is whether there's a way for me to make the batch file prompt me to select the destination folder from a gui, which would in this case be faster than trying to type a long, complicated, awkward name string from memory.

The end result would be that I get one of these computers, run the batch file from the server (so I don't have to keep copies of it everywhere), find and select the folder for it to copy into, and be done.

What I'm envisioning is a window just like when you download something and have to choose where to save it. Can I do that with a batch file (and if so, how?) or is that too sophisticated?

  • What windows OS? – EBGreen Jul 19 '12 at 20:42
  • It's definitely possible... Do you care if it uses a VBS script, or are you bent on using CMD/BAT? – Canadian Luke Jul 19 '12 at 20:42
  • set /s ... in cmd/bat? – Maximus Jul 19 '12 at 20:53
  • Some of the computers use XP and some use 7. – Josh Jul 20 '12 at 15:25
  • I'm not that particular about languages, as I'd be learning whatever it is on the fly anyway. – Josh Jul 20 '12 at 15:26

I would not use a Windows batch file for this.

I would use AutoHotKey which has a file chooser and can run batch commands such as Robocopy for you.

Once you have created your AutoHotKey script, there is a compiler to turn it into a single, stand alone .exe file that is easily distributed wherever you need it without having to install AHK everywhere (search for ahk2exe on this documentation page).

| improve this answer | |
  • AutoHotkey's file chooser appears not to be able to find a file server on a network, or at least it can't find the file server on mine. My (probably clumsy) file chooser line: FileSelectFolder, CopyDest, [\\ServerName\Path, 3] Am I doing it wrong? – Josh Jul 20 '12 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.