May 29, 2019
3
0
10
Hello,

I'm currently trying to write a batch script to automatically personalize some of my settings after Windows installations. I also want to make some changes to the Windows sounds. Therefore I'm trying to take ownership of the %windir%\media folder via the command line, which I'm running with admin rights. In my Windows XP VM, where I'm using the old cacls comment, this is possible without any problems. It's not working on my real Windows 10 machine though:

Code:
C:\Windows>icacls media /t /c /setowner %username%
media: Access is denied.
media\Afternoon: Access is denied.
media\Alarm01.wav: Access is denied.
media\Alarm02.wav: Access is denied.
media\Alarm03.wav: Access is denied.
media\Alarm04.wav: Access is denied.
media\Alarm05.wav: Access is denied.
media\Alarm06.wav: Access is denied.
media\Alarm07.wav: Access is denied.

And so on. The folder is owned by TrustedInstaller. I could of course get ownership via the Explorer (and I know how, I've done this before many times), but I want to get it done via a batch script/the command line. Any idea how I can do it? PowerShell is an acceptable solution, but only as a last option, I want to get it done inside the command line if possible.
 
D

Deleted member 14196

Guest
What you are doing will most likely break windows. it is not advisable for you to be the owner of any of those folders for a reason. Continue to do so and you will be reinstalling windows
 
May 29, 2019
3
0
10
I know it's risky, that's why I'm testing my scripts in a VM before running them on a real computer. So I don't see the issue with taking ownership of the %windir%\media folder, replacing the .wav and .mid files with my own .wav and .mid files, removing my permissions and changing the owner back to TrustedInstaller. I am fully aware of the risks, and I just want help with my original question.