If you add/change some environment variables (e.g. PATH) on windows, even after restarting 'VS Code' it will not be available in VS Code integrated terminals.
But if you open that terminal from windows (Command Prompt/Powershell/...) it will have those new/updated values!!
What should I do to refresh those environment variables? (without restart or log-out)
asked Feb 12, 2019 at 15:20
Mostafa AghajaniMostafa Aghajani
1,5161 gold badge12 silver badges18 bronze badges
1
You need to run the following line in a new window of one of your terminals (Command Prompt, Powershell, ...):
codeIt will open 'VS Code' once from them.
Now you can close and re-open 'VS Code' again as many time as you want using its normal shortcuts and have your
environment variables.
answered Feb 12, 2019 at 15:20
Mostafa AghajaniMostafa Aghajani
1,5161 gold badge12 silver badges18 bronze badges
9
This manually resets the path variable in the specific PowerShell terminal.
$env:Path = ` [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + ` [System.Environment]::GetEnvironmentVariable("Path","User")
answered Dec 7, 2021 at 6:38
Chocolatey comes with a RefreshEnv.cmd utility for this purpose, which worked for me. More convenient than opening other code instances.
answered Apr 12, 2020 at 0:21
LeeroyLeeroy
1,8231 gold badge14 silver badges21 bronze badges
2
I got the following to work (at least on VS Code 1.62.00).
- Restart VS Code
- Open a new terminal (via Terminal->New Terminal or Ctrl+Shift+` or with the + on the top right of the terminal window), do NOT use the existing terminals or View->Terminal.
Make sure that you are on the new terminal, as many times after restarting VS Code it might try to restore the old terminal.
The new terminal should be up to date.
answered Nov 5, 2021 at 17:54
yoel halbyoel halb
11.9k3 gold badges53 silver badges51 bronze badges
The following approach worked for me.
- Close VS Code
- Right click the VS Code icon pinned to the task bar
- Open VS Code again using the "New Window" option
The new environment variable will now be available
answered May 22 at 11:23
gerardgerard
82410 silver badges26 bronze badges
Issue Type: Bug
I'm using visual code with extension "Remote - SSH".
Open visual code terminal, run command like "ls", showing list file as usual.
But when I'm running command "ls" inside docker container, list file is not showing, need to expand the terminal then will show list file. The problem is like the terminal is not being refresh.
How to reproduce.
- Open visual code
- Install extension "Remote - SSH"
- Connect to remote host
- run one container
- exec into the container
- run command "ls"
- expected show list file, but not showing.
- expand visual code terminal, and list file showing.
VS Code version: Code 1.53.2
(622cb03, 2021-02-11T11:48:04.245Z)
OS version: Windows_NT x64 10.0.19042
Remote OS version: Linux x64 4.19.128-microsoft-standard
Remote OS version: Linux x64 4.19.128-microsoft-standard
Remote OS version: Linux x64
4.19.128-microsoft-standard
Remote OS version: Linux x64 5.4.0-1036-gcp
CPUs | Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2208) |
GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on protected_video_decode: unavailable_off rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | undefined |
Memory (System) | 15.80GB (3.37GB free) |
Process Argv | --crash-reporter-id 819c7bcf-b142-4917-a0dd-f7525bf6fbdf |
Screen Reader | no |
VM | 0% |
Remote | WSL: Ubuntu-20.04 |
OS | Linux x64 4.19.128-microsoft-standard |
CPUs | Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2208) |
Memory (System) | 12.32GB (8.84GB free) |
VM | 0% |
Remote | WSL: Ubuntu-20.04 |
OS | Linux x64 4.19.128-microsoft-standard |
CPUs | Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2208) |
Memory (System) | 12.32GB (8.84GB free) |
VM | 0% |
Remote | WSL: Ubuntu-20.04 |
OS | Linux x64 4.19.128-microsoft-standard |
CPUs | Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2208) |
Memory (System) | 12.32GB (8.84GB free) |
VM | 0% |
Remote | SSH: seagatesimi |
OS | Linux x64 5.4.0-1036-gcp |
CPUs | Intel(R) Xeon(R) CPU @ 2.20GHz (4 x 2200) |
Memory (System) | 14.65GB (12.07GB free) |
VM | 0% |
bracket-pair-colorizer-2 | Coe | 0.2.0 |
remote-containers | ms- | 0.158.0 |
remote-ssh | ms- | 0.64.0 |
remote-ssh-edit | ms- | 0.64.0 |
remote-wsl | ms- | 0.53.4 |
vscode-remote-extensionpack | ms- | 0.20.0 |
vscode-todo-highlight | way | 1.0.4 |
vscode-docker | ms- | 1.10.0 |
python | ms- | 2021.2.576481509 |
jupyter | ms- | 2021.2.576440691 |
vscode-yaml | red | 0.15.0 |
(1 theme extensions excluded)
A/B Experimentsvsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstry244cf:30256637 pythonvsdeb440:30248342 pythonvsded773:30248341 vstes627:30244334 pythonvspyt875:30251590