So last week I was trying to install Ant, and accidentally deleted my environmental variable Path. I dont really know what I am doing. What effect will this have/what can I do to fix it?


2 Answers 2


It’s hard to say what effect this would have. I wouldn’t think your computer would have an immediate problem.

The PATH keeps track of variable associations to locations in the file system. For example, a variable like APPDATA would be defined to point to C:\Users\User\AppData\Roaming.

That said, you need to restore it.

You can try to get it back by running the following command, according to this source that also does a good job of explaining what the environmental variable PATH is:

echo %PATH%

or doing System Restore.

  • The source link says nothing about echo %PATH% restoring it though.
    – Ramhound
    Commented Nov 26, 2014 at 5:05
  • Try scrolling 3/4 the way down the page. echo essentially means that the computer would repeat the PATH. This technique probably wouldn't work if the old PATH is no longer in memory. This, though, is all explained in the linked source. Commented Nov 26, 2014 at 5:16

I wouldn't worry too much about it, as fresh Windows installs come with an empty path anyway.

Windows uses PATH to configure paths to directories that contain programs. It is used to make life easier and not have to type full paths to all exe files.

For example, if you download Tiny C Compiler, and unzip it in C:\, you would expect the path to to tcc.ece to be "C:\TCC\bin\tcc.exe".

If you open cmd up, and type tcc.exe, an error would return stating that path cannot be found. This is because Windows scans all its known paths for a match in the command you provided. By default, system32 folder is checked first, and PATH values afterwards.

If you add 'C:\TCC\bin' to PATH, windows will search in bin folder for matching names of commands you give. After applying thr new settings and re-opening the cmd prompt, you can enter 'tcc -h', and the conpiler will display an its help message to you.

In essence, it provides "windows-level" shortcuts to program locations. This can affect you if software you used relied on PATH. For example, if you had nmap installed, it will no longer be accessable via 'nmap' command via cmd.

Watch out for new error messages, which point to errors in paths, and steadily rebuild them.

Format of PATH is: C:\nmap\bin;C:\TCC\bin;C:Tools

Have fun

Not the answer you're looking for? Browse other questions tagged .