Jman1993 Posted August 23, 2008 Posted August 23, 2008 (edited) I am currently trying to make a batch file to backup my settings, and I have needed this option for awhile, but I've never been able to find out how to do this... I've seen it done with VBS, bu I have no idea how it was done...I would like to have a popup box ask to select a file.... Then, I would like to have the box take the selected file (EG C:\program files\my program\myexe.exe) and do something like this inside my batch file...set program=C:\program files\my program\myexe.exethat way, I could later do this...copy "%PROGRAM%" "%SYSTEMDRIVE%\backup"Along with being able to select an individual file, I would also like to be able to select directories...Thank you in advance... Edited August 23, 2008 by Jman1993
Yzöwl Posted August 23, 2008 Posted August 23, 2008 You cannot directly create a popup per say, but you can get the batch file to ask you the question and wait for a reply.Here's a basic example with no error trapping at all.@Echo off&Setlocal enableextensionsSet/p "PROGRAM=Select a file: "Copy "%PROGRAM%" "%SYSTEMDRIVE%\backup"
jaclaz Posted August 23, 2008 Posted August 23, 2008 I would like to have a popup box ask to select a file....You can use a third party app.For a simple "file asking", check wfile :http://home.mnet-online.de/horst.muc/w32dial.htm#wfileFor a complete pseudo GUI I recommend Wizard's Apprentice:http://wizapp.sourceforge.net/You can do fairly complex things with it in batxh, see this example:http://home.graffiti.net/jaclaz:graffiti.n...ts/VDM/vdm.htmljaclaz
Jman1993 Posted August 23, 2008 Author Posted August 23, 2008 (edited) @YzöwlThat is how I currently do it... But, I then found a batch program called "Firefox addon maker" and it would popup a folder selection window! I just had to have that! I studied the batch and the vbs for almost an hour and got nowhere.... So I really got frustrated...@jaclazThis program seems like it would work... But here's what keeps happening...C:\>Wfolder CD "%SYSTEMDRIVE%" "Select your folder"cd "C:\Program Files"C:\>It says it changes the dir to "C:\program files", but for some reason it doesnt...The same happens when trying to set variables...ANy ideas? Edited August 23, 2008 by Jman1993
jaclaz Posted August 23, 2008 Posted August 23, 2008 Well, if you do not call temp.bat it would be tough for it to work. Try this:Wfolder CD %SYSTEMDRIVE% "Change Directory" > temp.batcall temp.batjaclaz
Jman1993 Posted August 23, 2008 Author Posted August 23, 2008 Well, if you do not call temp.bat it would be tough for it to work. Try this:Wfolder CD %SYSTEMDRIVE% "Change Directory" > temp.batcall temp.batjaclazAWESOME! It works! I can select files, dirs, and there are some other cool apps on that site... Thanks A LOT
jaclaz Posted August 23, 2008 Posted August 23, 2008 AWESOME! It works!Sure it does , did you actually doubt it? Now, let's get rid of the temp file (2K/XP/2003 and possibly Vista, NOT 9x/Me:@ECHO OFFFOR /F "tokens=1,* delims= " %%A in ('Wfolder CD %SYSTEMDRIVE% "Change Directory"') do %%A>nul&cd %%B>nulThe board parses long lines strangely, the above is just TWO lines, first one is:@ECHO OFFand all the rest is the second one.jaclaz
Jman1993 Posted August 23, 2008 Author Posted August 23, 2008 Thank you again! I'm currently tweaking my backup batch program
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now