You are here

Windows

How can I see the file system usage on Windows?

WinDirStat is a port of KDirStat for Linux. It's lightweight, small (650kb installer), fast, portable (as a standalone .exe file), and works on multiple versions of Windows. Besides showing folders and percentages (for the entire disk or any subset of folders), it also displays an (optional) graphical usage map. Works well with NTFS Junction folders, avoiding counting folders multiple times.

SpaceSniffer is another possibility. It can scan Alternate Data Streams (ADS) and correctly ignores junctions. However, it is not hard-link aware. If a file has multiple links, they will show up in the scan more than once. I've personally tested all this information to be accurate on Windows XP as of version 1.1.2.0.

FolderSize, since it's integrated into Explorer and caches the results. You always know how much space a folder is taking, and can easily identify space hogs. It's always there, so you don't have to start a separate program.

TreeSize Professional is a powerful and flexible hard disk space manager for Windows 8/7/Vista/XP or Windows Server 2012/2008/2003 (32 or 64 Bit). Find out which folders are the largest on your drives and recover precious disk space. Use TreeSize as a hard disk cleanup tool: find space hogs and remove them. Graphical analyses provide a quick visualization of disk space usage. TreeSize Professional shows you folder size and allocated disk space as well as owner and permissions, the last access date, the NTFS compression rate, and much more information for selected folders or drives.

JDiskReport enables you to understand how much space the files and directories consume on your disk drives, and it helps you find obsolete files and folders.The tool .analyses your disk drives and collects several statistics which you can view as overview charts and details tables.

What are PATH and other environment variables, and how can I set or use them?

Environment variables hold values related to the current environment, like the Operating System or user sessions.

One of the most well-known is called PATH on Windows, Linux and Mac OS X. It specifies the directories in which executable programs* are located on the machine that can be started without knowing and typing the whole path to the file on the command line. (Or in Windows, the Run dialog in the Start Menu or Win+R).

On Linux and Mac OS X, it usually holds all bin and sbin directories relevant for the current user. On Windows, it contains at least the C:\Windows and C:\Windows\system32 directories — that's why you can run calc.exe or notepad.exe from the command line or Run dialog, but not firefox.exe. (Firefox is located in C:\Program Files\Mozilla Firefox. For information on how to include Firefox, go here.)

For example, typing calc (the .exe can be omitted) in the command line on Windows will start up the Windows Calculator.

You can add support for file extensions other than .exe by editing %PATHEXT%.

Other variables might tell programs what kind of terminal is used (TERM on Linux/Mac OS X), or, on Windows, where the Windows folder is located (e.g. %WINDIR% is C:\Windows).

Creating new environment variables

In Windows, Linux and Unix, it's possible to create new environment variables, whose values are then made available to all programs upon launch.

You can use this when writing scripts or programs that are installed or deployed to multiple machines and need to reference values that are specific to these machines. While a similar effect can be achieved using program-specific configuration settings, it's easier to do this using an environment variable if multiple programs need to access the same value.

Windows GUI

Open Control Panel » System » Advanced » Environment Variables.

Type control sysdm.cpl,,3 in the Run dialog (Win+R) and click Environment Variables.

For editing user variables you can also type %windir%\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables in the Run dialog.

Right-click (My) Computer and click on Properties or simply press Win+Break.

In XP click on Advanced » Environment Variables.

In Vista+ click on Advanced system settings » Environment Variables.

There are many other ways of reaching the same place, such as by typing "environment variables" in the Start Menu/Screen search box and so on.

Environment variables in Windows are separated into user and machine/system specific values. You can view and edit their values there. Their current values upon launch are made available to all programs.

There is also Rapid Environment Editor, which helps setting and changing environment variables in Windows without the need to go deep into the system settings. Another open source program for Windows with which the path environment can be edited very conveniently is Path Editor.

Command Line

Environment Variables in Windows are denoted with moduli surrounding the name:

%name%

echo

To display an environment variable's value in cmd.exe, type echo %name%.

C:\>set  

then press enter.

C:\>echo %USERPROFILE%

C:\Users\Daniel

set

 

To create/set a variable, use set varname=value:

 

C:\>set FunnyCatPictures=C:\Users\Daniel\Pictures\Funny Cat Pictures

 

C:\>set FunnyCatPicturesTwo=%USERPROFILE%\Pictures\Funny Cat Pictures 2

To append/add a variable, use set varname=value;%varname%:

 

C:\>set Penguins=C:\Windows

 

C:\>set Penguins=C:\Linux;%Penguins%

 

C:\>echo %Penguins%

C:\Windows;C:\Linux

setx

 

To create/set a variable permanently, use setx varname "value":

 

C:\>setx FunnyCatPictures "C:\Users\Daniel\Pictures\Funny Cat Pictures"

 

[Restart CMD]

 

C:\>echo %FunnyCatPictures%

C:\Users\Daniel\Pictures\Funny Cat Pictures

Unlike set, there is no equals sign and the path should be enclosed in quotes if it contains any spaces. Note that if %PATH% is included, there will be spaces, so it is best to include quotes around paths that contain any variables.

 

You must manually add setx to versions of Windows earlier than Vista.

Windows XP Service Pack 2 Support Tools

 

List of Windows Environment Variables

 

Here is a list of default environment variables 1, which are built into Windows. Some examples are: %WINDIR%, %WINDIR%, and %APPDATA%.

 

Unix derivatives (FreeBSD, GNU / Linux, OS X)

Environment Variables in Linux are prefixed with a dollar sign ($) such as $HOME or $HOSTNAME. Many well-known and standard variables are spelled out in capital letters to signify just that. Keep in mind that variable names are case sensitive meaning that $User and $USER are entirely unrelated from the shell's point of view.

 

Unix derivatives define system wide variables in shell-scripts located mostly in the /etc folder, but user-specific values may be given to those variables in scripts located in the home folder (e.g /etc/profile, $HOME/.bash_profile). The .profile file in the home folder is a common place to define user variables.

 

Setting variables

 

These files are regular shell scripts and can contain more than just environment variable declarations. To set an environment variable, use export. To show your currently defined environment variables in a terminal, run env.

 

The export command is a standard way to define variables. The syntax is very intuitive. The outcome is identical for these two lines.

 

var=value; export var

export var=value

See the Linux documentation project, Path HOWTO for a more thorough discussion on this topic.

 

Perhaps contrary to common belief, OS X is more "Unix" than Linux. Additionally to the files already mentioned, $PATH can be modified in these files:

 

/etc/paths contains all default directories that are added to the path, like /bin and /usr/sbin

 

Any file in /etc/paths.d — commonly used by installers to make the executable files they provide available from the shell without touching system wide or user specific configuration files. These files simply contain one path per line. e.g: /Programs/Mozilla/Calendar/bin.

Subscribe to Windows