Access is denied.: how to modify APPDATA file?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
tinfanide
Posts: 117
Joined: 05 Sep 2011 09:15

Access is denied.: how to modify APPDATA file?

#1 Post by tinfanide » 05 Aug 2012 12:09

Code: Select all

ECHO.>%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\slideshow.ini


I would like to use batch scripts to modify the slideshow.ini file. Yet it returns:

Access is denied.


It's okay, though, to read the file with

Code: Select all

notepad.exe %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\slideshow.ini

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Access is denied.: how to modify APPDATA file?

#2 Post by foxidrive » 05 Aug 2012 12:15

cacls.exe can modify the permissions in a batch file.

You may need to change the permissions for the folder or branch as well as the file.

tinfanide
Posts: 117
Joined: 05 Sep 2011 09:15

Re: Access is denied.: how to modify APPDATA file?

#3 Post by tinfanide » 05 Aug 2012 12:25

Just found why the message was shown.

Code: Select all


ATTRIB -H %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\slideshow.ini
ECHO.>%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\slideshow.ini
ATTRIB +H %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\slideshow.ini


After realising the file is hidden (just a sudden thought), it'd be easy to fix it.
Just realise hidden files are protected from being modified.

Haven't tried your suggestion.
But learnt a new thing from you.
Lovely.
Thanks.

Post Reply