How do I delete a file using a batch script (or better method) from all users' (but not THE all users) directories?
01/13/2016 1953 views
We have an old shortcut that has not deleted itself from a program we no longer use across all of our systems. Is there a way to script the deletion of that file? Its on some of the individual users' desktop.
Community Chosen Answer
Please log in to answer
Yes, yes you can.
PowerShell, or your prefered scripting language would be best, NOT batch.
Hopefully the shortcut hasn't been renamed.
How I would go about: search the C:\users directory for the shortcut, if found then delete it. Put a exception in the code for the AllUsers directory.
This might help.
Run the script as local system or some account that has access, SYSTEM would be best as no ACL fiddle will need to be done.
Answered 01/13/2016 by: rileyz