I'm trying to write a batch file that will replace a file on users account machines. When I try to DEL the file from within the batch it tells me access is denied. I'm pretty sure it is because the permissions on the file are limited to read & write for users.
A batch runs whenever a user logs on to their PC that ties into another batch over a network share that updates files / programs when necessary. Basically, I can not go around and change the permissions of the file on all the PC's logging on as an administrator.
Is there a work around?
The code below is called by the initial batch script that runs when a user logs on. RUNME.bat file is the file that I can't delete as a regular user; which everyone is. RUNME.bat is not the initial batch that runs and is not in use when the batch runs to delete and replace it.
echo %username%,%date%,%time% >>\\server\share\netwrk\logon.csv
del C:\VDI\RUNME.BAT /q
xcopy \\server\share\NETWRK\VDI\RUNME.BAT "C:\VDI" /q /y
xcopy \\server\share\NETWRK\SHOCUT\GEN\VDI_Shares.lnk "c:\DOCUME~1\%username%\desktop" /q /y
ipconfig /all >\\server\share\NETWRK\COMPLE\IPCONF\%username%.txt
del "\\server\share\netwrk\comple\update\%username%.txt" /q
net use z: /del /yes >nul