Using batch file (cmd file, PowerShell, etc.) to write a protected dir


  1. Posts : 1
    Windows 10 Pro 21H2
       #1

    Using batch file (cmd file, PowerShell, etc.) to write a protected dir


    I am trying to programmatically copy or write files (link or files) to a protected directory (i.e. C:\Program Files, Default Start Menu) using like xcopy, robocopy. Windows prevents doing so by default and I would like to understand HOW to access these protected locations. This applies to Windows 11/10 and I believe earlier versions as well. Can someone light on how to access protected folders and provide example or two?

    -Thanks-
      My Computer


  2. Posts : 15,485
    Windows10
       #2

    GeekDad66 said:
    I am trying to programmatically copy or write files (link or files) to a protected directory (i.e. C:\Program Files, Default Start Menu) using like xcopy, robocopy. Windows prevents doing so by default and I would like to understand HOW to access these protected locations. This applies to Windows 11/10 and I believe earlier versions as well. Can someone light on how to access protected folders and provide example or two?

    -Thanks-

    The point of protected folders is to stop you doing what you are asking - what and why are you trying to do?
      My Computer


  3. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #3

    Hello @GeekDad66,
    Welcome to TenForums.

    cereberus said:
    The point of protected folders is to stop you doing what you are asking . . .


    Windows prevents doing so by default and I would like to understand HOW to access these protected locations.
    This is a start to understanding how to access these protected folders / files . . .

    > How to Add View Owner to Context Menu in Windows
    > How to Add Take Ownership to Context Menu in Windows 10
    > How to Change Permissions of File, Folder, Drive, or Registry Key for Users and Groups in Windows 10

    Also, have a look at the Related Tutorials at the BOTTOM of the above Tutorials [ there are a few ], as they may also be informative.

    I hope this helps.
      My Computer


  4. Posts : 16,946
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #4

    GeekDad66 said:
    Can someone light on how to access protected folders and provide example or two?
    It depends on what the particular permissions are for the folders you are trying to write to but many are accessible if you run the batch file / etc as Admin.
    In general, you'll encounter fewer obstacles by editing files elsewhere then copying the altered versions into the desired folder.

    GeekDad66 said:
    C:\Program Files, Default Start Menu
    There might well be different permissions within different subfolders of C:\Program Files.
    - Many are definitely accessible as Admin.
    - Exactly which folder paths are you talking about?
    I do not know what you mean by "Default Start Menu".
    - Exactly which folder path are you referring to?

    Denis
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 14:08.
Find Us




Windows 10 Forums