My batch file successfully creates new local directory and copies files from network drive. But I can't get it to create a Desktop shortcut afterwards
We have a folder with a bunch of files located on a network shared drive. I also have the .bat located on our network drive so it can be accessed by our staff.
Using md and robocopy I'm able to successfully create the folder and copy the files to the C:\ drive.
In this .bat I also have:
cd "C:\NewFolder"
COPY "C:\NewFolder\Shortcut.lnk" "%PUBLIC%\Desktop"
with the intention of creating a Public Desktop shortcut from one of the files in the newly created folder.
This ONLY works if I drag the batch file from the network shared drive to my desktop and run it. Which is ok, but I'd prefer for the batch to execute all commands from the network drive.
Seems simple...what am I missing?
Edit:
Here's the entire code:
md c:\NewFolder
ROBOCOPY "\\192.168.xx.xxx\folder\IT-FOLDER\NewFolder" "C:\NewFolder" /mir
cd "c:\NewFolder"
COPY "C:\NewFolder\Shortcut.lnk" "%PUBLIC%\Desktop"