If you accidentally deleted PATH, restore it at the same scope where it was removed: Windows User or System variables, or the startup file used by your macOS or Linux shell. Do not paste in a generic PATH string; the correct directories depend on your operating system, shell, distribution, and installed software. First save the current settings, then restore trusted entries from a machine-specific backup or configuration and verify them in a newly opened terminal.
Before you change PATH
PATH is a list of directories a system searches when you run a command by name. Windows separates directories with semicolons; macOS and Linux use colons. A missing entry can stop some commands from being found without removing the programs themselves.
- Identify your operating system and the shell or terminal where the problem occurs.
- Check whether PATH is missing only in one open terminal or also in newly opened terminals and applications.
- Record the current Windows User and System values separately, or make a copy of the shell startup file you plan to edit.
- If an older terminal or application is still open, it may retain an earlier environment value. You can inspect it as a possible reference, but do not assume it has the original PATH.
- Restore only directories you recognize and expect. PATH determines which executable runs when you invoke a command by name.
Recover PATH on Windows
Restore the correct User or System value
- Open System Properties → Advanced → Environment Variables.
- Inspect the User variables and System variables sections separately. Restore the value in the scope where it was deleted; do not replace one scope with the other.
- Preserve valid entries that remain, and separate each directory with a semicolon. Use a saved copy or known-good configuration for this specific computer rather than a generic list of Windows folders.
- Save the change, then open a new terminal or application and check whether representative commands are found.
Windows provides process, user, and machine scopes. A process-level change affects only that running process. User and machine values persist, and Microsoft says the System Control Panel writes persistent values to the Registry. Machine-scope changes require suitable permissions. See Microsoft’s PowerShell environment-variable documentation.
Inspect or change PATH in PowerShell
To inspect the PATH available to the current PowerShell process, run:
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
- Dual USB-A & USB-C Bootable Drive – compatible with nearly all Windows PCs, laptops, and tablets (UEFI & Legacy BIOS). Works with Surface devices and all major brands.
- Fully Customizable USB – easily Add, Replace, or Upgrade any compatible bootable ISO app, installer, or utility (clear step-by-step instructions included).
- Complete Windows Repair Toolkit – includes tools to remove viruses, reset passwords, recover lost files, and fix boot errors like BOOTMGR or NTLDR missing.
- Reinstall or Upgrade Windows – perform a clean reinstall of Windows 7 (32bit and 64bit), 10, or 11 (amd64 + arm64) to restore performance and stability. (Windows license not included.). Includes Full Driver Pack – ensures hardware compatibility after installation. Automatically detects and installs drivers for most PCs.
- Premium Hardware & Reliable Support – built with high-quality flash chips for speed and longevity. TECH STORE ON provides responsive customer support within 24 hours.
$Env:PATH
Assigning a value to $Env:PATH changes only that process and its child processes; it does not by itself repair the persistent User or Machine value. For persistent changes, Microsoft documents System.Environment.SetEnvironmentVariable() with the appropriate user or machine scope. Check the scope carefully before changing it, and preserve entries that are still valid. Start a new terminal after saving a persistent change because already-running programs may retain the environment they inherited when they started.
Recover PATH on macOS
- Determine which shell the affected Terminal window is running and whether the issue occurs in new windows too.
- Inspect the startup script used by that shell for an assignment that replaces PATH rather than extending it. Make a copy of the file before editing.
- Correct the destructive assignment or restore expected entries from a backup or documented configuration for your Mac and installed tools.
- Open a new Terminal window and check whether the expected commands work.
A shell’s environment is not automatically shared with other shells or terminal windows. Apple explains that to persist a variable across sessions and Terminal windows, you must set it in a shell startup script. Shell-launched applications inherit much of that shell’s environment. See Apple’s environment-variable guidance for Terminal.
Rank #2
- High-speed USB 3.0 performance of up to 150MB/s(1) [(1) Write to drive up to 15x faster than standard USB 2.0 drives (4MB/s); varies by drive capacity. Up to 150MB/s read speed. USB 3.0 port required. Based on internal testing; performance may be lower depending on host device, usage conditions, and other factors; 1MB=1,000,000 bytes]
- Transfer a full-length movie in less than 30 seconds(2) [(2) Based on 1.2GB MPEG-4 video transfer with USB 3.0 host device. Results may vary based on host device, file attributes and other factors]
- Transfer to drive up to 15 times faster than standard USB 2.0 drives(1)
- Sleek, durable metal casing
- Easy-to-use password protection for your private files(3) [(3)Password protection uses 128-bit AES encryption and is supported by Windows 7, Windows 8, Windows 10, and Mac OS X v10.9 plus; Software download required for Mac, visit the SanDisk SecureAccess support page]
Recover PATH on Linux or Bash
Check which Bash startup file applies
Bash reads different startup files depending on how it was started. For an interactive login shell, it reads /etc/profile, then the first available readable file in this order: ~/.bash_profile, ~/.bash_login, or ~/.profile. An interactive non-login shell reads ~/.bashrc. Other shells may use different files. GNU Bash documents these rules in Bash Startup Files.
Repair the applicable file
- Determine whether the affected shell is a login shell or an interactive non-login shell, then inspect the corresponding startup file and any system-wide files it loads.
- Copy the file before editing so you can restore it if needed.
- Find and correct any accidental assignment that overwrites PATH. Restore only expected directories from a backup or configuration appropriate to your distribution, user, and installed software.
- Open a new shell and verify that the commands you need resolve.
Linux systems may also configure persistent environment settings through locations such as /etc/environment or scripts in /etc/profile.d/. Which location matters depends on the distribution, shell, and setup; check the files your shell actually loads rather than adding the same entries to several places.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
Choose the repair that matches where PATH was deleted
| Where PATH was changed | Where to inspect or repair it | What persists |
|---|---|---|
| Current Windows process | The process environment, such as $Env:PATH in PowerShell |
Only that process and its child processes |
| Windows User variable | User variables in Environment Variables | Persistent user setting |
| Windows System variable | System variables in Environment Variables | Persistent machine setting; appropriate permissions are required |
| macOS shell session | The active shell’s startup script | Persists across sessions when set in the appropriate startup script |
| Linux or Bash shell | The startup file for the shell and invocation mode; possibly a system-wide file it loads | Depends on the file and shell configuration |
Why PATH may still be wrong after a repair
- It works in an existing shell but not a new one: the open shell may have retained its earlier environment. Check the persistent setting or startup file, then test in a fresh shell.
- It works in one shell but not another: shells are separate execution contexts, and different shell modes can read different startup files.
- A PowerShell fix disappears when you close the window: an assignment to
$Env:PATHchanged only the current process. Repair the persistent User or Machine setting if that is where the deletion occurred. - Some commands work and others do not: PATH may be incomplete rather than entirely missing. Add back only the known, missing directories and keep the valid entries.
- The value changes again after reopening a terminal: another startup file, shell mode, terminal host, or application may be setting PATH later. Trace the initialization order before adding entries again.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

