enjay Posted October 17, 2011 Posted October 17, 2011 I'm trying to run a batch script to delete a particular file from everyone's profile - when I run it, it returns the message that it couldn't find the file, even though it is definitely there. I'm wondering if this is because the file is inside a hidden directory. How can I script the deletion of these files?
cromertech Posted October 17, 2011 Posted October 17, 2011 That will be the reason but there is a way round it del /A:H {file} Should do it
LosOjos Posted October 17, 2011 Posted October 17, 2011 I'm trying to run a batch script to delete a particular file from everyone's profile - when I run it, it returns the message that it couldn't find the file, even though it is definitely there. I'm wondering if this is because the file is inside a hidden directory. How can I script the deletion of these files? First thing I'd do is dump the file paths to the command line to check you haven't missed out any slashes... that's caught me out a few times and made me feel rather dumb!
enjay Posted October 17, 2011 Author Posted October 17, 2011 The /a:h doesn't work, and the path is definitely good - I've copied it from the batch file and pasted it into Explorer, and it resolves.
cromertech Posted October 17, 2011 Posted October 17, 2011 Am I right in thinking you want to delete all files in a hidden folder? Take a look at this page Del - Delete Files In particular the following lines Folders If a folder name is given instead of a file, all files in the folder will be deleted, but the folder itself will not be removed.
enjay Posted October 17, 2011 Author Posted October 17, 2011 No, I want to delete a single (non-hidden) file in a hidden folder. Being specific, it is \\[server]\[user]\AppData\Microsoft\Templates\normal.dot which I want to delete, and the AppData folder is the hidden one. My batch file reads: del /q /a:h D:\\Users\Staff\[name]\appdata\Microsoft\Templates\normal.dot I suppose I could try DEL /F /S /Q %normal.dot% instead, kind of like being able to test these sort of commands first though...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now