I want to use the 7zip command line to back up files in a hidden or system directory on Windows 11 24H2. The folder I want to back up is
C:\Users\markc\AppData\Roaming\Microsoft\Windows\Start Menu
The command line I am using is
"C:\Program Files\7-Zip\7z.exe" a -tzip "D:\Dev\AutoBU\251112 Start Menu - Curr user.zip" "C:\User\markc\AppData\Roaming\Microsoft\Windows\Start Menu\*"
The quotes are around the 7zip program pathname and the arguments whose pathnames contain a space.
When I search on Google, several pages tell me that hidden files are included by default when using * wildcard, or when using a directory as the last item like this:
"C:\Program Files\7-Zip\7z.exe" a -tzip "D:\Dev\AutoBU\251112 Start Menu - Curr user.zip" "C:\User\markc\AppData\Roaming\Microsoft\Windows\Start Menu\"
With either command, 7zip starts up and gives status output, with this warning:
C:\User\markc\AppData\Roaming\Microsoft\Windows\Start Menu\ : The system cannot find the path specified.
The AppData folder in the path has its Hidden attribute set. I can see my AppData folder in Windows File Manager because I have the option set for "Show hidden files, folders, and drives".
Regardless of whether they are called "hidden" or "system", I need a way to back up the folder's contents.
As an aside, I am trying to execute this via a system() call within a C program, but it does the same when run from inside a batch file. The C program is used to include a yymmdd date stamp in the zip filename, which I don't see an easy way to do from inside a BAT file.