【问题标题】:create desktop file getting %userprofile%?创建获取 %userprofile% 的桌面文件?
【发布时间】:2016-05-27 09:26:49
【问题描述】:

我想获取桌面dir文件夹,所以我尝试了:

  char filename[ MAX_PATH ];
  char newLocation[]="%userprofile%\\desktop\\myfile.exe";
  BOOL stats=0;
  DWORD size = GetModuleFileNameA( NULL, filename, MAX_PATH );
  CopyFile(filename, newLocation, stats);

%userprofile% 不工作。如何获取用户配置文件路径?

【问题讨论】:

标签: c


【解决方案1】:

也许其他答案会有所帮助:

https://superuser.com/questions/571974/userprofile-variable-not-working

或:

https://superuser.com/questions/442158/why-cant-i-use-userprofile-in-path

您可以输入:

set

在命令提示符中,您将获得系统上定义的所有环境变量的列表。

【讨论】:

  • 感谢您的回答!是的,我认为在 C 中我不能使用 %userprofile% 或 %windir%...我会检查这个链接!
  • 所以也许这会更有帮助?(C++)stackoverflow.com/questions/6827496/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-08-16
  • 1970-01-01
  • 1970-01-01
  • 2020-08-30
  • 2023-03-28
  • 2020-02-04
  • 1970-01-01
相关资源
最近更新 更多