Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Recursiv set attrib flag bat-file

Posted on 2006-04-24
5
Medium Priority
?
632 Views
Last Modified: 2011-09-20
I need to make a solution that sets the attrib-flag for all files in a certain directory recursively (and all its subdirectories).

0
Comment
Question by:mdoland
  • 2
3 Comments
 
LVL 12

Expert Comment

by:AmigoJack
ID: 16524368
you have to:

- click start-> run
- enter "cmd"
- enter "attrib /?"
- view what it prints
- change the directory to where you want to start with "cd c:\windows\thisone\" for example
- use the attrib-command. an example to recursively set the "readonly" attribute to every file would be: "attrib +H . /S"

if you want to set or release always the same attribute(s) then you could add such a static command to the context-menu (left mousebutton click) of any folder. when you would select that, always the same attributes would be set/released for all files within that folder and recursively all files in every sub-folder
0
 

Author Comment

by:mdoland
ID: 16524451
Great! Could you explain that thing with static command that could be possible to use throughthe mouse?
0
 
LVL 12

Accepted Solution

by:
AmigoJack earned 500 total points
ID: 16525282
sure. to do this, first make sure what you want with the attrib-command. the following example sets the readonly-attribute and removes the hidden-attribute. if you want something else, you have to adapt the example or say it here what you want. its done recursively for every sub-folder.

- click start->run
- enter "notepad"
- copy all lines below after the first === and before the second === marker into notepad
- save the file somewhere (best would be desktop) as "something.reg". make sure it really has a .REG -ending
- doubleclick on the REG-file and yes, youre sure to merge it with the registry
- thats it. now open up explorer, right click on any folder and you will see the new entry. selecting this will execute the attrib-command like described above.

if you see the example but want to change something, simply edit the reg-file in notepad again, save it and then doubleclick it again - there is no "uninstall" orso to care about, the changes affect the system instantly.

===============start=================
REGEDIT4

[HKEY_CLASSES_ROOT\Directory\shell\myattrib]
@="here goes my description"

[HKEY_CLASSES_ROOT\Directory\shell\myattrib\command]
@="attrib +R -H \"%1\"\\*.* /S"

===============end=================

have fun :)
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your system is showing symptoms of browser hijacks or 'google search redirects' check out my other article (http://rdsrc.us/u3GP7A) first and run the tool TDSSKiller (http://rdsrc.us/GDBBs4) to get rid of the infection. Once done, and if the …
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question