Reputation: 101
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
Upvotes: 10
Views: 10613
Reputation: 645
I once had set a fix PATH in the VS Code setting terminal.integrated.env.windows
to replicate a special environment and than forgot about it. Uncommented the line and it worked again as expected:
Upvotes: 0
Reputation: 610
In case you open vscode from terminal using code
command.
All the exported variables in the terminal will be present in the vscode integrated terminal also.
In this case, try opening fresh terminal and open vscode from there.
Both of them will be having same value of PATH
.
Upvotes: 0
Reputation: 2165
If anyone else in the future ends up scratching their heads over this particular problem, I’ve found a culprit:
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.
Upvotes: 29
Reputation: 134
close last terminal in vs code by trash icon and open new terminal from Terminal>New Terminal menu in vs code in new terminal you can see change's
Upvotes: 1
Reputation: 101
I reinstalled the PlatformIO extension and this fixed it. Something must have gone wrong with the custom path variable option that comes with PlatformIO
Upvotes: 0