K1000: Simple Scripted File Copy

Though there are many ways to do this including a file sync I see a lot of users wanting to use a bat file to do this and running into issues. Probably because of the familiarity with DOS commands and not scripting syntax, especially KScripting.

The simple script below will let you create a DOS syntax script tfor use with kace to copy a file. 

Create a Online Shell Script

Attach a dependency and give the commands like below in the script text

A couple of notes here. 

Because the kscript runs as local system you wont run into any permoissions caused by launching your own batch file.

We have simply attached the file to copy as a dependency (in this case AgentErr.png)

Using xcopy withthe path to the script (you can find this by attaching your dependency and saving the script) Find you script in the list you are returned to and hover over it. The link to the script shows the ID, it should aslo be visible inthe address bar like. 


The part after ID= will be the number you use in your script.

lastly /y says yes to make sure there is no user interaction required and the /D tells XCOPY that our destination is a directory.


  • In my case, even with the /D option, the script still hung and asked if the destination was a file or directory. My solution was to simply add a slash at the end of the destination. For instance "c:\users\public\desktop\" /y /D - mveras1972 2 years ago
This post is locked
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