Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VScode terminal's PATH enviroment variable different from cmd

When i run echo %Path% in vscode's terminal, the result is:

C:\Users\user\.platformio\penv\Scripts;C:\Users\user\.platformio\penv;C:\Users\user\.platformio\python3;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\NAT Service;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files....

But when I run it in the command line(cmd.exe) the result is:

C:\Program Files\AdoptOpenJDK\jdk-8.0.292.10-hotspot\bin;C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin;C:\Program Files (x86)\NAT Service;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerSh...

which is different from the one i got in vscode. i tried switching inherit env on and off, restarting vscode, and restarting my computer but nothing changes.

How can i make the %Path% in vscode the same as the one in cmd.exe?

my current vscode settings are:

{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"terminal.external.windowsExec": "C:\\Windows\\System32\\cmd.exe",
"window.zoomLevel": 0,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.configuration.checkProjectSettingsExclusions": false,
"java.errors.incompleteClasspath.severity": "ignore",
"java.project.importOnFirstTimeStartup": "automatic",
"terminal.integrated.tabs.enabled": true,
"files.autoSave": "afterDelay",
"workbench.colorTheme": "Default Dark+",
"java.configuration.runtimes": [
    {
        "name": "JavaSE-16",
        "path": "C:\\Program Files\\AdoptOpenJDK\\jdk-16.0.1.9-hotspot",
        "default": true
    },
    {
        "name": "JavaSE-1.8",
        "path": "C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.292.10-hotspot"
    },
],
"java.home": "C:\\Program Files\\AdoptOpenJDK\\jdk-16.0.1.9-hotspot",
}

for user settings and

"settings": {
    "java.configuration.updateBuildConfiguration": "automatic",
}

for workspace settings

like image 264
programmer3481 Avatar asked Mar 04 '26 03:03

programmer3481


1 Answers

If anyone else in the future ends up scratching their heads over this particular problem, I’ve found a culprit:

Showcase of setting Terminal>Integrated>Env: Enable Persistent Sessions

I suspect what happens is that after you update system paths, VScode caches the old path in the terminal and persists it. This is also true even if you restart the browser.

Toggling this option off and restarting VSCode clears that cache, and works perfectly for me. You can toggle it back on after you’re done.

like image 160
Enthus3d Avatar answered Mar 06 '26 19:03

Enthus3d



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!