Skip to main content

How to get control over files and folders in Windows

There are times when you need to take control over files and folders. Mostly it is required to be able to delete or move them.
Windows gives us some simple command line tools to gain access to those files and folders.

TakeOwn: Gives a user (current user if no user is specified) complete control of the particular file(s) or folder(s)
iCacls: Gives the administrator group, full permissions (in this case) over the file(s) and folder(s)

For Files:
takeown /f file_name
icacls file_name /grant administrators:F
For Folders (recursively):
takeown /f directory_name /r /d y
icacls directory_name /grant administrators:F /t

The files or folders could be hidden and you might want to see, esp. if the files are system files. For this use the attrib command to reset the hidden and system attributes.

Use it as (for both files and folders):
attrib -h -r -s /s /d pathname

These commands can be clubbed in a single batch file and the file / folder name can be passed as a parameter and can be accessed as "%1" in the batch file.
Try more options to suit your requirements!
- Vivek


Popular posts from this blog

Count and Label DNA strands

This is a proof of concept (POC) developed using Python3, NumPy, and OpenCV, to count and label the number of DNA strands from an image of combed DNA molecules.
The technique of Adaptive Mean Thresholding is used here.
There are several Thresholding algorithms available.

Assembla hit by a virus?

Today hosted task management site Assembla was hit by some virus. Around 3 hours back we got Service Unavailable - DNS failure error when trying to access the portal.
Trying to call any API from Assembla returns with the following unwanted HTML code prepended to the response:
<html><head><meta http-equiv="refresh" content="0; URL="></head><body><a href="">Please click here</a></body></html>
We have logged a ticket with them. The response was quick but when we tried to post a reply comment we consistently got error - Your CAPTCHA words didn't match We'll keep on chasing them for updates and hope safety for Assembla users.

- Vivek

Of Imitation, Innovation, Inspiration and Improvisation

Copy-paste was never easier, thanks to modern technology. Ideas and innovations now spread even faster. When a product is launched in the market, within a few days, we have other vendors with a similar offering. The case is more severe with mobiles and tablets.