|
Answer» Hello,
I have known simple batch stuff for a while. And only just started to get back into it.
Hopefully someone out their can answer my questions:)
Basically i have uploaded a FOLDER(BOB-FOLDER) which users download. The users save the folder(BOB-FOLDER) to their desktop, The folder contains .dll files and files that already exists. The batch file searches for this folder on their desktop and then it searches for the folder where the BOB-FOLDER is to be copied to. If the batch searches and cant find either folder it closes the batch. Theirs no prolem here.
What i am after is how can i copy the files in BOB-FOLDER on desktop(%USERPROFILE%\Desktop\BOB-FOLDER\files) to C:\PROGRA~1\BOBTEST~1\TEST Also if the file exists which it already will because this UPDATES the .dll files, It probrally wont work. So how can i make it copy the folders files and to make sure UAC and Parental Controls allow this feature.
Im thinking i would need to add a message box thats asks for their permission to move and replace files. I dont mind if the batch does that.
But how do i go about doing this process?I hope I'm understanding your question correctly.
In order to copy all the folders from BOB-FOLDER\files to C:\PROGRA~1\BOBTEST~1\TEST, you would use:
Code: [Select]copy %USERPROFILE%\Desktop\BOB-FOLDER\files\*.* C:\PROGRA~1\BOBTEST~1\TESTThat should work.
About the message box... there would be a complicated VBScript WAY to do that, but a simpler way to ask for confirmation is:
Code: [Select]set /p x=Are you sure you want to copy BOB-FOLDER's files? [Y/N]: if /I '%x%' == 'y' ( goto copybob ) else ( echo No? Okay, press any key to close... pause > nul exit )
:copybob copy %USERPROFILE%\Desktop\BOB-FOLDER\files\*.* C:\PROGRA~1\BOBTEST~1\TEST && echo Copy successful. pause
When prompted, press Y to copy the files and any other key to not do it.
This file assumes that BOB-FOLDER\files exists... if you need it to check, then use at the beginning:
Code: [Select]if not exist "%USERPROFILE%\Desktop\BOB-FOLDER\files\" echo Error! BOB does not exist &pause &exit
If you get any errors, tell me, I didn't test this.Ahhh beautiful.
I was using: MOVE %USERPROFILE%\Desktop\BOB-FOLDER\files*.* C:\PROGRA~1\BOBTEST~1\TEST instead of : MOVE %USERPROFILE%\Desktop\BOB-FOLDER\files\*.* C:\PROGRA~1\BOBTEST~1\TEST
Forgot the "\" ha.
Thankyou. Would this process still work the the person had User Account Control on and Parental Controls on?sorry to double post.
But if you once did that and this process still worked even if the person had User Account Control on and Parental Controls on; How would you delete a folder?
I know that DEL does this. But this doesnt work for all WINDOWS OS's How would i got about making a bathc that deletes a folder that will work on any windows OS eg it would delete a folder on winxp,win7,win8,vista?
Quote from: bobbybronkxs on February 11, 2012, 06:47:29 PM I know that DEL does this. But this doesnt work for all windows OS's How would i got about making a bathc that deletes a folder that will work on any windows OS eg it would delete a folder on winxp,win7,win8,vista?
I'm not sure if I'm understanding correctly, but if you want to delete a folder, try using the RMDIR command. That should work on Windows 2000 or up. I don't know about windows 8, but it hasn't been officially released yet.
|