i'll admit that the syntax used here is over my head and i need to do just a little reading before i can break this down the way i should be able to
Basically, it's this:
* cmd.exe /c - runs command prompt silently
* Q: - change current drive to Q:
* && - when the previous command is done, run the command just after this
* takeown /a /f "%%X*" - give administrators ownership of the file/folder stored in variable "%%X"
in order to set permissions, you need to be the owner (or one of the owners) of the file/folder you're trying to set permissions on
* icacls "%%X" /remove:d /grant administrators:F - remove deny permissions and give administrators full control
* FOR /R %%X IN (".") DO - the main part of the for loop
** the /R switch means recursive, which means look in every directory and subdirectory
** %%X - the variable which stores the directory, file name, or filename plus directory that the for loop is currently looking at
** IN (".") - the base directory or file to start from initially. A single dot means whichever directory the command prompt is at already.
** DO - command is given after this, acting on whatever file/directory is stored in the variable.
but, where it says "/grant administrators:F", could that be changed to everyone?
Yes.
and how can i integrate this into the right-click menu i see in My Computer making Q whichever drive i click on? the drive letter assigned would probably change depending on if the customer's hdd has a recovery partition or something similar.
I think you just add whatever command you want to the registry in
HKEY_CLASSES_ROOT\Drive\shell\[insert command name here]\command in the "(Default)" string
Or you could add it to
HKEY_CLASSES_ROOT\Folder\[insert command name here]\command if you want to add a command to folders
To make the drive/folder variable (as in, replaced by whatever drive/directory you're right-clicking on), replace
Q: in the command with
pushd %1
So you'd end up with this:
cmd.exe /c pushd %1 && FOR /R %%X IN (".") DO takeown /a /f "%%X*" && FOR /R %%X IN (".") DO icacls "%%X" /remove:d /grant administrators:F
http://sites.google.com/site/apokalipse/registry.png