Windows: Which folders always offer write permissions?
Asked Answered
S

3

6

The question is really clear.

Which (Windows-) folders always have write permissions?

So I need to find a folder which always has write permissions on any system for any application.

Currently I used %AppData% but I got notifications from some users that the path had no write permissions (especially on public computers).

Stowe answered 27/5, 2016 at 18:36 Comment(0)
A
4

Which folders are writable depends on not only the OS but also the security/guarding system installed on that computer. Some anti-virus software, or system admins, can install/create very restricted data access policies on computers. For a public computer, most likely %TEMP% folder might be the only common writable folder. Without writing access to temp, many applications won't run at all. Of course, you can't expect data will be saved permanently under temp folder.

The second hopeful place will be user's local data folder, normally AppData/Local, if you don't need to consider roaming data. Again, it depends on what kind of access restriction on that computer.

See this link about Windows appdata folders.

https://msdn.microsoft.com/en-us/windows/uwp/app-settings/store-and-retrieve-app-data

Adieu answered 27/5, 2016 at 19:11 Comment(3)
I need to store data permanently. I am aware of the problem that a public computer can be restricted in a way I will not be able to store any data permanently but I'm searching for a place that will most likely offer write permissions. %AppData% resolves to AppData/Roaming, so your advice would be to switch to AppData/Local? I don't think that Windows-API is the way to go. External Apps/Libs (sometimes the user) must be able to access the files.Stowe
I don't mean you should use Windows API. It is a reference how Windows defines its folder usage. %appdata% resolves to AppData/Roaming, %localappdata% resolves to AppData/Local. In terms of permission control, I don't think there is any difference. It really depends on if you want to store data locally or not. If your application has to store some data in order to run it successfully, you might try a list of locations. saying %AppData% first, then %LocalAppData%, last %TEMP%, which should give user a warning data might be purged by the system.Adieu
Actually roaming data might have a stricter policy as it will be copied to file server, and then sync with other devices. Potentially a malicious roaming data can cause more damage than local one.Adieu
H
2

Though some security models may put it off limits, there is a good chance that the %PUBLIC% directory is fair game.

Henigman answered 9/1, 2019 at 6:16 Comment(0)
E
0

Windows provides the Roaming Application Data folder and the Local Application Data folder specifically for use by applications. If the system administrator has locked these down, it probably means that the users aren't supposed to be running third-party applications. (The only other obvious possibility being that the system administrator is incompetent.)

Other possibilities include the Documents folder ... basically any of the per-user folders are expected to be writable under normal circumstances. Of course, the system administrator can make any of these unwritable. But that shouldn't be your problem.

Note that you should be using the SHGetKnownFolderPath function or equivalent to determine the folder path, not reading an environment variable. You haven't specified your language, but there are lots of already answered questions about how to do this.

Also, you shouldn't write files directly to the application data folders; instead, create a subfolder and put the files there.

Escalade answered 27/5, 2016 at 23:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.