Takeown /f D:\Windows /r /D Y
Takeown /f "D:\Program Files" /r /D Y
Takeown /f "D:\Program Files(x86)" /r /D Y
Attrib -s -r -h D:\ProgramData
Takeown /f D:\ProgramData /r /D Y
Icacls D:\Windows /grant %Username%:F /t /c
Icacls "D:\Program Files" /grant %Username%:F /t /c
Icacls "D:\Program Files(x86)" /grant %Username%:F /t /c
Icacls D:\ProgramData /grant %Username%:F /t /c
I want later to be able to get acces to each command as a string for example:
"Icacls "D:\Program Files(x86)" /grant %Username%:F /t /c"
I can make:
string[] params = new string[] {....};
But i'm getting messed up with the directories since some of them have to be between commas like: "D:\Program Files"
So far i tried this:
string[] commands = new string[] {
"Takeown /f D:\\Windows /r /D Y", "Takeown /f ""D:\Program Files""\ /r /D Y"};
But getting errors on the part: "D:\Program Files""\ /r /D Y"
Syntax error, ',' expected Unrecognized escape sequence Error ',' expected Unrecognized escape sequence