windows – 为什么setx路径不起作用?
有人可以解释这个结果吗?
设置路径后,它没有改变.这是在管理员命令行中运行的: C:Windowssystem32>setx path "C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:ProgramDatachocolateybin;D:Program Files (x86)Microsoft VS Codebin" SUCCESS: Specified value was saved. C:Windowssystem32>path PATH=C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:ProgramDatachocolateybin;D:Program Files (x86)Microsoft VS Codebin;D:Program Files (x86)metapad36;D:Program Files (x86)metapad36" /M 我已经读过用户的机器PATH变量的%PATH%= PATH变量.我看到机器路径Admin的路径了吗? 看过关于这个话题的其他文章,但仍然困惑. 我应该清除用户路径,所以没有重复吗? 更新:重新提示“此工具创建或修改的变量将在以后的命令窗口中可用”我打开一个非管理员窗口并输入: >path PATH=C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:ProgramDatachocolateybin;D:Program Files (x86)Microsoft VS Codebin;;D:Program Files (x86)metapad36;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:ProgramDatachocolateybin;D:Program Files (x86)Microsoft VS Codebin 路径重复两次.好的,然后在相同的提示我设置路径没有重复,没有/ M: >setx path "C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:ProgramDatachocolateybin;D:Program Files (x86)Microsoft VS Codebin" SUCCESS: Specified value was saved. 显然保存在当前用户环境中. 然后我打开一个新的非管理命令窗口,并: >path PATH=C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:ProgramDatachocolateybin;D:Program Files (x86)Microsoft VS Codebin;;D:Program Files (x86)metapad36;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:ProgramDatachocolateybin;D:Program Files (x86)Microsoft VS Codebin` 它没有改变.为什么?
在Windows中,每个进程都获得一个环境副本,该环境本质上是进程启动时全局环境的快照.进程运行时对全局环境的更改不会传播回进程自己的环境副本.
要回答实际问题,setx会修改用户环境(如果使用/ M运行,则会修改系统),但在执行setx的进程中不会立即看到更改,在本例中为cmd.exe.如果在运行setx后打开新的命令提示符,则会在该cmd.exe实例中看到更改. 这在setx /中明确指出.救命:
要在全局环境和当前进程中实现相同的更改,您需要同时运行setx和set. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- windows – 如何检查多个用户是否使用网络共享EXE文件?
- mschart – Microsoft图表控件图例项目排序
- C#写入日志的方法
- wpf – Crystal Reports:使用Crystal Reports的log4net.dl
- wpf – 如何在XAML中绘制单独的圆圈?
- windows-server-2008-r2 – 使用WDS将同一图像部署到具有不
- 变量 – Windows批处理文件:什么是变量扩展,EnableDelayed
- 在Windows 7上更改/重置postgresql用户密码
- 在Windows(Vista)中将文件重命名为空文件名
- windows – 企业Samba文件服务器管理
- Windows Azure中的Web角色缩放
- New-Object上的Windows RT Powershell(Permissio
- iis – 在端口80上的Windows Server 2012上运行G
- 为什么我的WPF窗口大小默认是巨大的
- .net – 在Windows应用程序中格式化标签内的文本
- windows-7 – 机器始终响应192.168.1.2 IP地址,该
- Win32 Api函数调试中断
- winforms – Devexpress Windows Controls使用不
- 用于Windows 8.1 / Windows 10的C#中的Cordova插
- windows – 使用PowerShell每隔x秒运行一个批处理