Active5 months ago
Open your AppData folder and you’ll see Local, LocalLow, and Roaming folders. Let’s start with Roaming. The Roaming folder contains data that would “roam” with a user account from computer to computer if your PC was connected to a domain with a roaming profile. The AppData folder, which contains subfolders containing program data and settings, is one. Open a Windows File Explorer window and go to the 'View' tab.
As you all know, the appdata folder is this
on windows 7
Since my application will be deployed on all kinds of Windows OSes i need to be able to get the folder 100% percent of the time.The question is how do you do it in C++? Since i don't know the the exact Windows OS it could be XP,Vista or 7 and most importantly i don't know what the Username is.
dikideradikidera87644 gold badges2020 silver badges3636 bronze badges
3 Answers
For maximum compatibility with all versions of Windows, you can use the
It requires that you specify the CSIDL value for the folder whose path you want to retrieve. For the application data folder, that would be
SHGetFolderPath
function.It requires that you specify the CSIDL value for the folder whose path you want to retrieve. For the application data folder, that would be
CSIDL_APPDATA
. On Windows Vista and later, you should use the
SHGetKnownFolderPath
function instead, which requires that you specify the folder's KNOWNFOLDERID
value. Again, for the application data folder, the appropriate value is FOLDERID_RoamingAppData
.To use either of these functions from your C++ application, you'll need to include
Cody Gray♦Cody Grayshlobj.h
.201k3838 gold badges405405 silver badges487487 bronze badges
You can try the following:
This code reads the environment variable APPDATA (you can also see it when you type
SET
in a command window). It is set by Windows when your system starts. It will return the path of the user's
Abelappdata
as an absolute path, including Username and taking into account whichever OS version they're using.43.9k1818 gold badges119119 silver badges204204 bronze badges
iptqiptq48711 gold badge55 silver badges1515 bronze badges
Use this Code to reads the environment variable 'APPDATA'
Include stdio.h file in beginning
Include stdio.h file in beginning
Akash dasAkash das
Not the answer you're looking for? Browse other questions tagged c++appdata or ask your own question.
Summary
This article provides effective methods to help you effectively find and restore lost AppData folder and files within simple clicks. If you accidentally deleted or lost AppData folder or files in Windows PC, don’t worry. Just follow offered methods here in this article to get lost AppData files back now.
Can I recover deleted or lost AppData folder and files?
'Does anyone knows how to recover lost AppData folder and files back? I lost my Excel this morning and I was thinking that I may have a chance to find the autosaved files in AppData folder.
The whole AppData folder got emptied. Nothing was there. Where else can I find the lost files and folder in AppData folder?'
The whole AppData folder got emptied. Nothing was there. Where else can I find the lost files and folder in AppData folder?'
'Do you have any ideas about how to recover deleted AppData folder? Yes, you are not hearing me wrong. I'm asking for a way to recover deleted AppData folder back in Windows 10.
The AppData folder got deleted by mistake in my computer while I was trying to get lost excel files with the roaming data in the AppData folder: appdataroamingmicrosoftexcel. I thought that all deleted or lost files may get recycled in the Recycle Bin. But it turns out that nothing was there in the recycle bin. What else can I do to get the lost AppData folder back with all files?'
The AppData folder got deleted by mistake in my computer while I was trying to get lost excel files with the roaming data in the AppData folder: appdataroamingmicrosoftexcel. I thought that all deleted or lost files may get recycled in the Recycle Bin. But it turns out that nothing was there in the recycle bin. What else can I do to get the lost AppData folder back with all files?'
If you are having a similar problem and can't restore or find AppData folder or files in Windows 10, 8 or 7, don't worry. Right below, you'll find a reliable method to effectively restore AppData folder and files now.
Recover emptied AppData folder or restore lost AppData folder in Windows
In order to help you effectively recover lost or find emptied AppData files, it's highly recommended you don't save any new data into the hard drive and then find a suitable tool for help.
Here now, we'd like to recommend you try the best file and folder recovery software - EaseUS Data Recovery Wizard for help. It allows you to effectively find and restore lost files and folder within 3 simple steps in Windows 10, 8 or 7 etc systems. Just free download and let this software to restore your lost AppData folder with files now:
Step 1. Run folder recovery software.
- Launch EaseUS folder recovery software on your PC.
- Connect the device to your computer if the lost folder is saved on an external storage device.
- Click 'Specify a location' to choose the exact location where you lost the folder.
- Click 'Scan' to begin scanning lost folder with files.
Step 2. Find lost folder.
- You can use the 'Search' feature to quickly find the lost folder by searching the folder name.
- Or you can check and find them from 'Deleted Files', 'Drive (with your device name)'.
Step 3. Recover the lost folder.
Last, select the folder and choose to save it to a new & secure spot on your PC by clicking 'Recover'.
After this, you can create a new folder named AppData and then copy those files back to the folder in C drive under username folder again.