Dism /Apply-Image and remove the entire content of the directory

Page 1 of 2 12 LastLast

  1. Posts : 305
    Windows 10
       #1

    Dism /Apply-Image and remove the entire content of the directory


    Hi

    I installed Windows ADK 10 v1511 on Windows 10 v1511 Enterprise 64 bit.

    I typed the following commands:

    Code:
    Dism /Apply-Image /ImageFile:"<wim_File_Path>\install.wim" /Index:1 /ApplyDir:"<Apply_Directory_Path>" /Verify /CheckIntegrity
    Dism /Capture-Image /ImageFile:"<Windows_Files_Path>\sources\install.wim" /CaptureDir:"<Apply_Directory_Path>" /Name:"<Edition_name>" /Description:"<Description_name>" /Compress:max /Verify /CheckIntegrity
    Now, what is the command that allows to completely remove the entire content of the <Apply_Directory_Path> directory?

    Thanks

    Bye
      My Computer

  2. lx07's Avatar
    Posts : 5,479
    2004
       #2

    Do you mean you want to delete everything in the directory but leave the directory itself?

    If so this should do it
    Code:
    pushd "<Apply_Directory_Path>" && (rd /s /q "<Apply_Directory_Path>" 2>nul & popd)
      My Computer


  3. Posts : 305
    Windows 10
    Thread Starter
       #3

    lx07 said:
    Do you mean you want to delete everything in the directory but leave the directory itself?

    If so this should do it
    Code:
    pushd "<Apply_Directory_Path>" && (rd /s /q "<Apply_Directory_Path>" 2>nul & popd)
    I already tried and this command does not work because the files and directories owner is the System or TrustedInstaller user.

    I noticed that the <Apply_Directory_Path> directory has also changed owner and now it has, as owner, TrustedInstaller user. Why?

    Thanks

    Bye
      My Computer

  4. lx07's Avatar
    Posts : 5,479
    2004
       #4

    You can try to take ownership with
    Code:
    takeown  /f  "<Apply_Directory_Path>" /r
    icacls       "<Apply_Directory_Path>" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
    and then delete the contents.
      My Computer

  5. Kyhi's Avatar
    Posts : 3,710
    Windows 3.1 to Windows 10
       #5

    You applied the install.wim to the directory... Thus by applying the install.wim - you installed windows (trusted installer)....
      My Computer


  6. Posts : 305
    Windows 10
    Thread Starter
       #6

    lx07 said:
    You can try to take ownership with
    Code:
    takeown  /f  "<Apply_Directory_Path>" /r
    icacls "<Apply_Directory_Path>" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
    and then delete the contents.
    Unfortunately, in the <Apply_Directory_Path> directory, there are also some read-only subdirectories.

    So, how do I change the icacls command to also remove the read-only attribute to delete also these subdirectories?

    Thanks

    Bye
      My Computer



  7. Posts : 305
    Windows 10
    Thread Starter
       #7

    I await a reply.

    Thanks

    Bye
      My Computer

  8.   My Computer


  9. Posts : 305
    Windows 10
    Thread Starter
       #9

    If I write:

    Code:
    takeown  /f  "<Apply_Directory_Path>" /r
    icacls "<Apply_Directory_Path>" /grant "%USERDOMAIN%\%USERNAME%":(F,WDAC) /t
    I reach the same my purpose?

    Thanks

    Bye
      My Computer


  10. Posts : 305
    Windows 10
    Thread Starter
       #10

    In conclusion, if I use the following commands

    Code:
    takeown /f "<Apply_Directory_Path>" /R /A /D Y
    icacls "<Apply_Directory_Path>" /grant administrators:(F,WDAC) /t
    pushd "<Apply_Directory_Path>" && (rd /s /q "<Apply_Directory_Path>" 2>nul & popd)
    I would reach my initial goal?

    Thanks

    Bye
      My Computer


 
Page 1 of 2 12 LastLast

  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 09:09.
Find Us




Windows 10 Forums