/build/static/layout/Breadcrumb_cap_w.png

batch Script or Vb script for deleting files and folders in a location then copy files to the same location

Hi all,

Seeking your help. I need a batch script or vbscript that should delete files and folder in a particular folder and copy the files and folder to the deleted location.

"%UserProfile%\AppData\Roaming\Microsoft\Signatures\"

I want to delete the files and folders inside Signatures folder

then i need to copy some files and folder(updated ones) to the same Signatures folder.

This is the scenario. Please help

3 Comments   [ + ] Show comments
  • DEL /F /Q "%UserProfile%\AppData\Roaming\Microsoft\Signatures\*"
    XCOPY "\\Server\SourceHere\*" "%UserProfile%\AppData\Roaming\Microsoft\Signatures\" /Y /S - alphabeta 6 years ago
  • batch script is not working. Possible for Vb?
    Delete the Signatures folder and then copy the updated one from source to same Microsoft location? - lgovindprakash 6 years ago
  • If you are running this as a script. be sure it is set to Online KScript and also select to run as Logged-in User. Otherwise it'll clear/copy the files for the user that is running the script and not affect the current logged in user's files. - DaveMT 6 years ago

Answers (2)

Posted by: five. 6 years ago
Second Degree Green Belt
0
This sounds like something you would want to use file sync instead. That way you could have versioning and such.

Since it is Microsoft related, is it something you can do with windows on? Does it have to be done in safe mode?
Does the batch script work outside of kace? Is the user an admin? Do you have to run it via elevated command prompt?
Posted by: ISEKOLD 6 years ago
Orange Senior Belt
0
I made a script to do this when I would have to switch between computers. Not sure how much this will help with your situation, but it should point you in the right direction. This script would copy the signatures folder from my main work computer.

rmdir /S /Q "C:\Users\username\AppData\Roaming\Microsoft\Signatures\"

XCOPY \\ISEKOLD-PC\C$\Users\username\AppData\Roaming\Microsoft\Signatures\* C:\Users\username\AppData\Roaming\Microsoft\Signatures /s /i /Y

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ