简体   繁体   English

我在哪里可以创建没有管理员权限的目录?

[英]Where can I create a directory without admin rights?

I am trying to create a directory with my program, but the program will not be run under admin.我试图用我的程序创建一个目录,但该程序不会在管理员下运行。 Where in the Windows file system can I create a directory and write to the directory without admin rights?我可以在 Windows 文件系统中的哪个位置创建目录并在没有管理员权限的情况下写入该目录?

Without admin permissions the intended behavior is that you can write to the folders inside the user account folder.没有管理员权限,预期行为是您可以写入用户帐户文件夹内的文件夹。

C:\\Users\\%USERNAME%\\ C:\\用户\\%USERNAME%\\

You can write to the documents, pictures and music sub folders, AppData\\Roaming or AppData\\Local\\ etc...您可以写入文档、图片和音乐子文件夹,AppData\\Roaming 或 AppData\\Local\\ 等...

As mentioned in the comments SHGetKnownFolderPath is the preferred method to get these folder paths, here is a simple example:正如评论中提到的SHGetKnownFolderPath是获取这些文件夹路径的首选方法,这里是一个简单的例子:

#include <windows.h>
#include <iostream>
#include <shlobj_core.h>

int main()
{
    PWSTR path = nullptr;

    SHGetKnownFolderPath(FOLDERID_Documents, 0, 0, &path);

    std::cout << path << std::endl;

    std::getchar();
    return 0;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在哪里可以创建没有管理员权限/权限的目录? - Where can I create a directory without Administrator Rights / Privileges? 我可以在没有管理员权限的情况下使用 NVM 吗? - Can I use NVM without admin rights 如何在没有Windows管理员权限的情况下部署Django应用? - How can I deploy a django app without windows admin rights? 如何创建一个 windows 应用程序,该应用程序应该在.Net C# 中以管理员权限运行,而不会一次又一次地提示 UAC? - How can I create a windows application that should run with admin rights in .Net C# without prompting UAC again and again? 检查应用是否可以在没有管理员权限的情 - Checking if app can run without admin rights? 我在哪里可以放置LOCALMACHINE以外的普通用户数据-没有管理权限的注册表 - Where can i place common user data other than LOCALMACHINE -Registry without Administrative Rights 在没有管理员权限的情 - Changing registry without admin rights 没有管理员权限的安装服务 - Installing service without admin rights 如何在PowerShell中以当前外壳中的管理员权限运行命令? - How can I run a command in PowerShell with admin rights in the current shell? CreateProcess()可以授予管理员权限吗? - Can CreateProcess() give admin rights?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM