Takeown for current directory - taking ownership

cowrulz

New Member
Hi, I want to basically take ownership in a batch file of all folders in the current directory. I want to use it to make sure i have access to copy all of the data on a customer's drive before backing it up (and later realising there's data missing, particularly the user folder). I'm creating a batch file that deletes junk files and backs up the data automatically but I'm having trouble.

I know the right-click context menu "Grant Admin Full Control" works perfectly but I want to do it to the current directory in a batch file so my other commands can run afterward, rather than taking full control and coming back ages later to do the next step, I want to make it one step. I have tried a few methods of the web but none appear to be doing the job. the best I can get is about 3 methods that seem to take ownership of the current folder once for every file in the directory which isn't helpful and I think I once got it to take ownership of the folders only but not files... any help?
 

My Computer

Hello cowrulz and welcome to the forums :party:

Do you mind if it works for all files in the current directory and all sub-directories? This way we can use the /R switch:

/r Performs a recursive operation on all files in the specified directory and subdirectories.

So our batch file would look something along the lines of:

Code:
takeown /r %CD%

Tom
 

My Computer

System One

  • Manufacturer/Model
    Build #1
    CPU
    Intel Core i7 3770K @4.4GHz
    Motherboard
    ASUS P8Z77-V PRO
    Memory
    Corsair Vengeance 2x4GB DDR3 1600MHz Low Profile (White)
    Graphics Card(s)
    Gigabyte Radeon HD 7850 (2GB GDDR5)
    Sound Card
    Integrated on motherboard
    Monitor(s) Displays
    23" LG LCD/LED IPS
    Screen Resolution
    1920*1080
    Hard Drives
    Samsung EVO 128GB SSD
    Seagate Barracuda 2TB 7200rpm
    2x500GB Seagate FreeAgent 5400rpm
    PSU
    Corsair TX650W V2 (80+ Bronze)
    Case
    NZXT Phantom 410
    Cooling
    Corsair H100 Water Cooler, 1x140mm and 1x120mm stock fans
    Keyboard
    Microsoft Desktop 2000 Wireless Keyboard
    Mouse
    Microsoft Desktop 2000 Wireless Mouse
    Internet Speed
    95 Mb/s Download 70 Mb/s Upload
Back
Top