Jump to content

Recommended Posts

Posted
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?
Posted
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!

Posted
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.
Posted

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.

Posted

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...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...