Delete/rename file whilst hidden via attribute

January 21, 2012 at 05:10:54
Specs: Windows 7
I need to find a way which is able to delete a file hidden with current set attribute to +h without having to do the opposite(-h). With the start xxx command it has no problem once inside the directory while hidden but when trying to delete/rename, it says file not found.
So basically, how can i rename or delete a file that has its attribute set to +h.
Also i need a command which is able to retrieve the current directory from which the batch file was originally launched from.

See More: Delete/rename file whilst hidden via attribute

Report •

#1
January 21, 2012 at 06:17:46
To catch the current directory which the batch was launched from use the following %~dp0 (i.e. device/path modifier for parameter 0).

About deleting a hidden file without reversing its h attribute, that isn't possible.


Report •

#2
January 21, 2012 at 06:48:37
Appreciate your post, haven't tried it yet though. But are you certain there is no way? via using a vbs file or anything similar?

Report •

#3
January 21, 2012 at 07:11:19
There is no way using a batch script; about VBScript I can't say anything since my know-how is limited. Anyway why do you want to avoid the attribute reversing for a file to be deleted?

Report •

Related Solutions

#4
January 21, 2012 at 07:18:58
Fewer lines of code and i want it hardly noticeable. Meaning hidden all the time.

Report •

Ask Question