适用于所有 Windows 版本的所有用户桌面路径的环境变量是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6038580/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the environment variable for the All Users Desktop path that works across all versions of Windows?
提问by Chaddeus
I'm trying to write a batch file that can copy a file from my computer to all computers in a list. It needs to be copied to the AllUsers Desktop (I'll use a domain admin account to run the batch file).
我正在尝试编写一个批处理文件,该文件可以将文件从我的计算机复制到列表中的所有计算机。它需要复制到 AllUsers 桌面(我将使用域管理员帐户来运行批处理文件)。
On my Win7 system, the %ALLUSERSPROFILE%
returns C:\ProgramData. Is there a variable that returns the AllUsers Desktop path across every version of Windows? I have a mix of XP, Vista, and Win7.
在我的 Win7 系统上,%ALLUSERSPROFILE%
返回 C:\ProgramData。是否有一个变量可以返回每个 Windows 版本的 AllUsers 桌面路径?我有 XP、Vista 和 Win7 的组合。
采纳答案by CharlesB
回答by Kyle P
It is %public%
in Windows 7...
它%public%
在 Windows 7...
回答by user3887965
in vista, 7, 8
在远景, 7, 8
%userprofile%\..\Default\Desktop
%userprofile%\..\Default\Desktop
回答by Robert Tozzi
%public% works for Windows 10 and Windows 2011 Server and up
%public% 适用于 Windows 10 和 Windows 2011 Server 及更高版本
%ALLUSERSPROFILE% is used in Windows XP
%ALLUSERSPROFILE% 用于 Windows XP
But, you can look to see what the available variables are by running "SET" from a command prompt
但是,您可以通过从命令提示符运行“SET”来查看可用变量是什么