Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有什么方法可以在 64 位机器中检索环境变量。我已经有 %abc% ,它在 32 位机器中返回我的变量,但在 64 位机器中不起作用。
我的错误:我怎样才能通过命令行而不是通过编程语言?
在 PowerShell 中,您将获得环境变量
$Env:abc
这与位无关。
在cmd你可以得到环境变量
cmd
%abc%
这也与位无关,所以如果你能详细说明你到底尝试了什么,失败的地方和方式,那就太好了。
尝试 System.Environment.GetEnvironmentVariable("abc")