Posts Tagged ‘system’

Take Ownership of a File or Folder by Command in Windows

Wednesday, April 3, 2013 posted by CSch

Taking ownership of files in Windows is necessary to edit or delete system or program files that you have no access to by default. There are multiple ways to achieve that goal, like doing everything manually through the Properties menu, applying a registry tweak or, as described here, executing a command in the Command Prompt. Note that taking ownership will not let you edit every system file. Windows has set precautions so that you don't edit any of the most important files which may be helpful in some cases but can be really, really annoying in other.

To start off, you need an elevated command prompt which is simply a command prompt opened as administrator. In Windows 8 you can open that by right-clicking the bottom left corner of the screen and selecting Command Prompt (Admin). In Windows 7 and previous, search the main menu for cmd, right-click it and select Open as administrator.

You need two commands now: one to actually take ownership of the file or folder and one to grant yourself access rights. These are the two commands you will want to use:

For folders, use:

takeown /f folder_name /r /d y
icacls folder_name /grant username_or_usergroup:F /t /q

For files, use:

takeown /f file_name /d y
icacls file_name /grant username_or_usergroup:F /q

The commands basically only differ in a few switches that make the folder procession run recursively. If you want to edit only one folder instead of the whole recursive lot, remove the /r and /t switches from the commands. For more info on the commands, simply enter takeown /? or icacls /? into the command prompt.

If I wanted to take control of my Program Files folder, I'd need to enter the following:

takeown /f "C:\Program Files" /r /d y
icacls "C:\Program Files" /grant christian:F /t /q

Hide folders by making them system folders on Windows

Thursday, April 26, 2012 posted by CSch

One of the basic things one does while configuring a Windows system is to enable viewing hidden files. So basically it is impossible to hide files by making them "hidden".

What helps against most nosy people though is to make a file a system file or folder - that way the tagged file will remain hidden even if "hidden" files are made visible (of course one can still make system files visible but few people will enable that since it's usually not necessary).

To tag a file a system file, open a command prompt by entering cmd into your search bar. Enter following into the command line, replacing the path I use with the one to your file (+s is for systemfile and +h is for hidden):

attrib +s +h C:\Users\howtoforge\Desktop\bla

To make it visible again, just turn the plusses into minusses:

attrib -s -h C:\Users\howtoforge\Desktop\bla

“No space left on device” error on empty drives

Thursday, March 15, 2012 posted by CSch

It may occur that when you try to copy files from your hard disk to an external device such as an external HDD or a USB key, you get an error stating that there was no free space left on your device although you just erased everything from it to make some. This is most likely due to limitations of the file system your drive uses - newer drives might already use the NTFS file system while older will still use FAT32 or even FAT16.

The thing is that FAT32 formatted drives only support files up to a maximum size of 4GB - for example if you try to put an image file of 6 GB onto an external, FAT32 formatted hard drive of 320 GB with 100 GB of those still free and not in use, the copying will fail. To change this, you have to format the target drive to the NTFS file system.

Formatting will erase all data on a drive, so backup everything you have on it beforehand. Afterwards, right-click the drive in your file browser and choose Format....

On the appearing window, there will likely be an FAT file system on the File System drop-down menu (if it already says NTFS there, this guide won't solve your problems). Before you change anything, double-check that you picked the right drive. Then change the file system to NTFS and click Start.

Change System Sounds on Windows 7 (Including Startup)

Tuesday, February 7, 2012 posted by CSch

This article will deal with two aspects: handling the regular sounds which are accessible in Control Panel as well as changing the system startup sound, which is hidden inside a .dll file and quite tricky to get at.
The regular sounds can be accessed by entering the Control Panel and browsing to Control Panel\Hardware and Sound\Sounds\Change system sounds. A window with selectible sound schemes will open where you can either select a premade scheme or browse your files to choose other .wav files and save a custom scheme. The checkbox below the list already indicates that you will not find the Startup sound in it - you will need third party software for that.

The reason for this requirement is that the startup sound isn't configurable by "normal" means - it is hidden inside a .dll file, C:\Windows\System32\imageres.dll. Before you make any changes to it, make a backup-copy of it to some safe place and also one on your desktop to work with. Afterwards, download a resource hacker - these tools are used to access the data inside .dll files which can be sound files as well as icons and other things. I prefer ResEdit since it does not need an installation. You can download it here:

http://www.resedit.net/

In ResEdit, open the copy of imageres.dll you saved to your desktop.

On the left Resources column, find the "WAVE" entry - there is exactly one file in there, which has different names depending on your system language - I'm using American English, which is why it's called 5080 here (replace any occurance of that number here with the one you have for your language). To be able to import your own sound, it also must be in the .wav format and must be called the same as the file you just found.
Now delete the 5080 entry in ResEdit - right-click it and choose Remove from project. Then right-click on some empty space in the Resource column and select Add Resource... > User Definded. A window pops up - select Name identifier and type in WAVE. Now browse the sound file you want to configure as startup sound and hit Open (I don't know the maximum size of the file you can use, you might try to keep it as small as possible - it worked for me with a file size of ~90kb, others have reported more). It will have the wrong name and language defined after you import it, so you have to change that: Right-click the entry and select Rename. Leave the Ordinal identifier checked and enter 5080 into the identifier box, then select the correct language for you (Englisch (United States) if you had 5080) and hit OK. Afterwards save the file in ResEdit.

Now comes the tricky bit which is replacing the imageres.dll in your System32 folder with the one you edited. If you try to just do it, Windows will most likely hit you with the Permission-Denied-club, no matter how many administrative rights you have got. People have reported that it worked for them in save mode. A save option however is to boot off a Linux Live CD (I used Linux Mint 12 Lisa) and replace the file in the Live environment.

Therefore, just download a CD image file from here or any other Linux distribution's homepage, burn it onto a bootable CD and boot from it.

You will boot into the Live environment, from which you can test and install Linux or if you need, fix stuff on your Windows installation. I will go on with the instructions assuming you chose Linux Mint 12 from the link I provided, if you chose differently you will likely know how to accomplish the next steps on your system.
To replace the file, hover your cursor to the top left corner of the screen - an overlay will pop up. Type in terminal and open the first object of the list appearing:

This is the command line and will be needed in a few moments. Hover to the top left corner again and click on the nautilus icon on the left to open a new file manager window:

On the appearing window, have a look at the left column - there are different (or only one) drives listed, you should be able to determine your Windows system drive by its size or contents. Click on it once to show them. What is important now is the value that is shown on the window decoration on top of the window, circled in red here:

You basically need only the first few characters. Now go back to the terminal you opened and enter

sudo su -

to grant yourself administrative rights. Next, you do the copying. For that, use the following command. You can use the tab-key to autocomplete the path segments, so you don't have to write out the whole value from above. Replace my username with yours and weirdvalue with the drive's value:

cp -f /media/weirdvalue/Users/howtoforge/Desktop/imageres.dll /media/weirdvalue/Windows/System32

The file is now replaced and you can reboot, removing the CD when told to. If you encounter problems with the new imageres.dll, just repeat the process and copy the backup you made to the System32 folder instead.

System Control Gadget for Window 7 Sidebar

Tuesday, November 29, 2011 posted by CSch

System Control is the right gadget if you are looking for functionality on low space use - it combines buttons for the regular system commands such as shutdown and restart, but also task manager, command-prompt, control panel, screen saver, run and additionally lets you set a timer to execute the available commands at a certain time:

Furthermore, System Control appeals with its high level of customisation. Download on http://buildagadget.com/wsg-system-control/.

Create System Restore Points in Win XP automatically

Friday, October 7, 2011 posted by CSch

Since older system restore points are deleted after some time, it is always good to create some new regularly. But to always have to browse through the countless menus day by day can be really annoying, that is why we will use Windows' Notepad and Scheduled Tasks functions to ease our lives.
First we create a short script that creates system restore points in our notepad, therefore open one and type in these two lines:

Set auto_rp = getobject("winmgmts:\\.\root\default:Systemrestore")
auto_sys_rp = auto_rp.createrestorepoint ("Automatic System Restore Point", 0, 100)

When saving, make sure to not save it as text document but select All Files from the Save as type dropdown menu and name it something like automatic_sysrp.vbs. vbs is the type of file here, make sure you have it correct, since otherwise the script will not be executable.
Now that you have created the script, you can doubleclick it to create a system restore point. But to have it done automatically, we are going to use Windows' Scheduled Tasks function. Therefore, enter Start > Control Panel > Performance and Maintenance > Scheduled Tasks. Select File > New > Scheduled Task from the control bar. Give it a name, rightclick it and select Properties.

In the opened window, browse the location of the vbs script you just created and go to the Schedule tab. Enter a time when the restore point shall be created and click on Apply when you are finished. A new system restore point will now be created at the time you specified or on doubleclick upon the script.

Encrypt Folders (Ubuntu Linux)

Friday, September 30, 2011 posted by CSch

To encrypt folders on Linux Ubuntu there is a simple program called Cryptkeeper which, while active, lets you mount and dismount password protected folders.

While unmounted, the encrypted folders are invisible to the user. While mounted, you need to enter the password to access its contents. To create a new encrypted folder just click on the key icon on the system panel and select New encrypted folder.

Make sure to unmount the encrypted folders before you quit Cryptkeeper since the files become accessible if they are mounted and Cryptkeeper is inactive. The files remain invisible if they are unmounted and Cryptkeeper is quit.

How to Clean Up Unnecessary Files with Bleachbit (Linux Mint)

Friday, September 23, 2011 posted by CSch

Everyone knows the problem of previous installations leaving behind loads of data rubbish on your computer and you may know how hard it can be to remove this data. With bleachbit however you can easily check the data you want to remove and the program does the rest.

You can run it either as normal user or as root, to be sure you really remove every unnecessary file on your harddisk. It is available in the standart Ubuntu repositories.