Looking for a Windows HOWTO

I am an UNIX only admin and run restic successfully for several years together with rest-server and NetApp S3.

I now want to offer restic for Windows users, too, but my Windows knowledge is nearly zero. I even do not have access to a Windows system.

Is there a HOWTO for Windows which explains how to use restic?

I know Installation — restic 0.19.1-dev documentation but there is no explanation on how to set the needed environment variables

RESTIC_REST_USERNAME
RESTIC_REST_PASSWORD
RESTIC_REPOSITORY
RESTIC_PASSWORD_FILE                                                                                                                                                                           
RESTIC_COMPRESSION                                                                                                                                                                             

And I need a script which calls “restic backup …” and “restic forget …” in one go for a full backup.

How to set an environment variable is outside of restic’s scope, it’s simply something you do the way that your specific operating system or shell wants you do to it. I think you can find a ton of pages on the Internet that explains how to set environment variables in Windows, e.g. this one: Environment Variables for Java Applications - PATH, CLASSPATH, JAVA_HOME

If you want something to run restic for you, I’d recommend third party tools like resticprofile or the more recent Restray. I’ve personally used resticprofile and think it’s great. But there are many different tools, although I know these two work on Windows, thats the main reason I mentioned them.

@Framsfex have a look here if your windows users are not comfortable with the commandline in windows:

p.s. great to see so many items being developed, something to fit everyone.

  1. May I suggest looking at one of my previous posts Restic on Windows: Another user trying to exclude directories - #5 by punchcard for things which could be or should be in an exclude file?

  2. On most Windows machines there will be a virus checker. You should tell the virus checker to ignore restic.exe because the virus checker will eat cpu cycles and ram trying to monitor what restic is doing.

  3. Depending on your own circumstances, you may want to change the “power” setting. If there is no one at the keyboard actively doing things, the machine may go into sleep, or shut off in the middle of the backup. The first backup will be the longest.

  4. My personal experience is that installing / using PowerShell 7 is much much better than .bat files.

  5. In PowerShell How to set environment variables I find that I need to use “$global:variable_name” then “$env:variable_name” to ensure that the variable is visible to restic. I am not 100% sure this is necessary but it works.

Hope this helps.

I could run “restic backup C:\” on Windows 10, but restic reports hundreds of read errors:

error: openfile for readdirnames failed: open \?\C:\Windows\Provisioning\Autopilot: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\Resources\Themes\aero\VSCache: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\ServiceProfiles\LocalService: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\ServiceProfiles\NetworkService: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\ServiceState: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\SysWOW64\Com\dmp: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\SysWOW64\Configuration: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\SysWOW64\FxsTmp: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\SysWOW64\Msdtc: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\SysWOW64\Tasks: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\SysWOW64\config: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\SysWOW64\networklist: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\SysWOW64\sru: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\System32\Com\dmp: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\System32\Configuration: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\System32\DriverState: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\System32\FxsTmp: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\System32\MsDtc: Access is denied.
error: open \?\C:\Windows\System32\Sysprep\Panther\diagerr.xml: Access is denied.
error: open \?\C:\Windows\System32\Sysprep\Panther\diagwrn.xml: Access is denied.
error: open \?\C:\Windows\System32\Sysprep\Panther\setupact.log: Access is denied.
error: open \?\C:\Windows\System32\Sysprep\Panther\setuperr.log: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\System32\Tasks: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\System32\Tasks_Migrated: Access is denied.
error: openfile for readdirnames failed: open \?\C:\Windows\System32\WDI: Access is denied.
error: open \?\C:\Windows\System32\catroot2\edb.log: The process cannot access the file because it is being used by another process.
error: open \?\C:\Windows\System32\catroot2{127D0A1D-4EF2-11D1-8608-00C04FC295EE}\catdb: The process cannot access the file because it is being used by another process.
error: open \?\C:\Windows\System32\catroot2{127D0A1D-4EF2-11D1-8608-00C04FC295EE}\catdb.jfm: The process cannot access the file because it is being used by another process.
error: open \?\C:\Windows\System32\catroot2{F750E6C3-38EE-11D1-85E5-00C04FC295EE}\catdb: The process cannot access the file because it is being used by another process.
error: open \?\C:\Windows\System32\catroot2{F750E6C3-38EE-11D1-85E5-00C04FC295EE}\catdb.jfm: The process cannot access the file because it is being used by another process.
error: openfile for readdirnames failed: open \?\C:\Windows\System32\drivers\DriverData: Access is denied.
(…)
Files: 51158 new, 0 changed, 0 unmodified
Dirs: 7804 new, 0 changed, 0 unmodified
Data Blobs: 51007 new
Tree Blobs: 6104 new
Added to the repository: 10.016 GiB (5.624 GiB stored)

processed 51158 files, 10.804 GiB in 9:31
snapshot e5488972 saved
Warning: at least one source file could not be read

Is this a general restic/Windows problem or a mistake by myself?

I am using restic 0.19.1 with rest-server

Personally I can’t help but wonder why on earth you’d want to back up your Windows directory.

That said, did you try using the --use-fs-snapshot option?

Also, did you follow @punchcard’s advice and made sure that there’s no antivirus or malware software interfering with restic’s access to files?

Also, did you run restic with privileges enough to read system files?

Since Windows is what it is, there’s usually some files that I’d expect to be inaccessible to any software you run. But I also didn’t try to back up my Windows directory so I can’t say for sure exactly what to expect.

--use-fs-snapshot is new to me, the Linux restic does not has this option.

But when I try it, I get:

c:\restic>restic.exe --insecure-tls backup -v --use-fs-snapshot --exclude-file C:\restic\exclude A:\ B:\ C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ N:\ O:\ P:\ Q:\ R:\ S:\ T:\ U:\ V:\
A:\ does not exist, skipping
B:\ does not exist, skipping
D:\ cannot be accessed, skipping
E:\ does not exist, skipping
F:\ does not exist, skipping
G:\ does not exist, skipping
H:\ does not exist, skipping
I:\ does not exist, skipping
J:\ does not exist, skipping
K:\ does not exist, skipping
L:\ does not exist, skipping
M:\ does not exist, skipping
N:\ does not exist, skipping
O:\ does not exist, skipping
P:\ does not exist, skipping
Q:\ does not exist, skipping
R:\ does not exist, skipping
S:\ does not exist, skipping
T:\ does not exist, skipping
U:\ does not exist, skipping
V:\ does not exist, skipping
open repository
repository c8f93a99 opened (version 2, compression level auto)
using parent snapshot ab1b55b1
load index files
[0:00] 100.00%  3 / 3 index files loaded
VSS error: The caller does not have sufficient backup privileges or is not an administrator: E_ACCESSDENIED (0x455f41434345535344454e494544)

I do not now how to detect or deactivate antivirus software.

How can I run restic with all needed privileges?

I am logged in as “admin” and I thought, I am the administrator?

What are you even trying to do here? It seems to me that you are shooting commands like you’re trying to squash mosquitos on the sky with a bazooka.

Why would you even contemplate trying to back up e.g. A:\, to take one example?

There is so much weird stuff going on here that I’m not sure where to start. If you want my honest personal opinion, it seems to me that you are lacking the fundamentals of how to handle a Windows system, and the problems you have due to that is something that would apply to any software you try to run. You need to figure out the basics before you can use the specifics.

To run restic as administrator from the command line, you must start the command line (or Powershell) as Administrator. It’s IME not enough to have logged in as Administrator.

How do make sure that restic is not blocked by an antivirus program or similar, it’s down to what antivirus software that is and so on.

This would seem like you are not running as administrator. A unix person might say that you need to be root. See cmd as administrator for the regular command line. For PowerShell I open a powershell as administrator and use the following commands to check:

$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
if ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) -ne $true){
Write-Host “ERROR. STOP NOW. You need to run this program as Administrator.” -fore red
$errnum += 1
}

Why would you even contemplate trying to back up e.g. A:\, to take one example?

I want a full backup, therefore I use A:\ .. Z:\ because Windows does not have a root directory like UNIX with /

My Windows knowledge is nearly zero, I do not use it all, but I need to write a documentation how to use restic on Windows. If there is a a ready to use HOWTO “restic for windows” documentation, I will point to that and delete my own crappy documentation.

How do I start the cmd window as administrator?

On UNIX I just log in as root or run su -

I offer my Windows restic users a ZIP contining:

restic@rs1:/home/restic/windows: l
-RW-      4,078 2026-07-14 13:48 exclude
-RW-        849 2026-07-14 13:36 LIESMICH.txt
-RW-        254 2026-07-13 02:30 rbackup.cmd
-RW-        281 2026-07-14 12:57 restic.cmd
-RWX 31,660,032 2026-07-05 09:52 restic.exe
-RW-         27 2026-07-13 12:16 restic_cmd.cmd

restic@rs1:/home/restic/windows: cat restic_cmd.cmd
cmd /K "cd /d c:\restic\"

I tell my usrers to put this restic_cmd.cmd on their Winows desktop.

How do one run it as administrator?

FYI:

restic@rs1:/home/windows/restic: cat restic.cmd
set RESTIC_HOSTNAME=
set RESTIC_PASSWORD=
set RESTIC_REST_SERVER=
set RESTIC_REST_USERNAME=
set RESTIC_REST_PASSWORD=
set RESTIC_REPOSITORY=rest:https://%RESTIC_REST_SERVER%:8000/%RESTIC_REST_USERNAME%/%RESTIC_HOSTNAME%
set RESTIC_COMPRESSION=auto
restic.exe --insecure-tls %*

restic@rs1:/home/restic/windows: cat rbackup.cmd 
restic.cmd backup -v --exclude-file C:\restic\exclude A:\ B:\ C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ N:\ O:\ P:\ Q:\ R:\ S:\ T:\ U:\ V:\ W:\ X:\ Y:\ Z:\
restic.cmd forget --compact --prune --keep-daily 7 --keep-within-weekly 30d
restic.cmd check

On the Start/Windows meny, type “cmd”, then for the Command thing that shows up as suggestion, select “Run as administrator” as @punchcard suggested.

I wouldn’t recommend trying to back up drive letters that don’t even exist. For example A: and B: is historically for the floppy drives in the system, which you likely don’t ever have any. And other drives which aren’t mapped – trying to back them up is like specifying /foo and /bar when neither of those exist. Also, what if a drive letter happens to be a mounted file share or similar – are you going to back that one up as well? Generally speaking, only back up what you know you want to back up, thats my recommendation at least.

Some people specify to back up the entire C:\ and possible some other drive(s) where they keep data (e.g. D: if that’s a pure data drive), but I’d presume they do so with some exclusions in place so that they don’t try to back up system files that they’d just reinstall on a system to be restored. Restic isn’t designed to be a full system backup utility, such a design goal is very specific and few backup softwares are really made for that. One of them would be Veeam Backup & Replication.

But at the end of the day, I personally don’t think there’s any good reason to back up entire systems – doing so is solving a problem that should be solved in other ways than using backups.

This starts a cmd window with the default directory, I need to run restic_cmd.cmd (from the desktop) which does a “cd” to the restic install directory. Otherwise one cannot use it.

How can I start restic_cmd.cmd with administrator rights?

So, I can always ommit A: and B:? They are no longer in use at all?

My rbackup.cmd is just a template, the Windows restic user should adapt it.

I do not know which drive letters they have in use.

If they want to backup a “mounted file share”, then it is ok for me as the restic server admin.

As I do not use Windows at all, my restic setup is just a template for other Windows user which never heard of restic before: “WHAT? How do I make a backup with it?”

You run it from within a command prompt that is running with Administrator rights.

Yes.

It might be better to make the example have just a couple of paths instead of the entire set of drives. With or without instructions they ought to be able to specify the paths that they do want to back up, by modifying that example.

I disagree. Those servers should be backed up in other ways, not from one or multiple clients that mounted shares off the servers.


I understand that you don’t use Windows daily and for that reason have limited experience with it.

I think the best thing you could do, to make sure that the product you deliver to your users is designed and suited for the relevant environments and use cases, is to team up with someone in your organization that has more experience with Windows.

Together, with your understanding of restic and the other person’s understanding of Windows, you can then make sure that the offering you’re putting together for your users is in good shape.

That’s probably the best advice I can give you, and I really think it would be of value to both you and your users. It is simply too far from ideal to deliver a backup solution to users with this little Windows experience, to be frank. I’m telling you this with only good intentions.

An addon question: Do I have to remove this fs-snapshot manually afterwards?

What happens if I terminate the restic backup run?

Next problem: restic backup reports a lot of unsupported (irregular) files:

error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\Microsoft.OutlookForWindows_8wekyb3d8bbwe\olk.exe: unsupported file type "irregular"pData/Local/Microsoft/Windows/WebCache/WebCacheV01.dat
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\Microsoft.SkypeApp_kzf8qxf38zg5c\Skype.exe: unsupported file type "irregular"dmin/AppData/Local/Microsoft/Windows/WebCache/WebCacheV01.dat
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\Microsoft.WindowsStore_8wekyb3d8bbwe\microsoftstore.exe: unsupported file type "irregular"Local/Microsoft/Windows/WebCache/WebCacheV01.dat
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\Microsoft.WindowsStore_8wekyb3d8bbwe\store.exe: unsupported file type "irregular"/AppData/Local/Microsoft/Windows/WebCache/WebCacheV01.dat
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\Microsoft.XboxGamingOverlay_8wekyb3d8bbwe\GameBarElevatedFT_Alias.exe: unsupported file type "irregular"t/Windows/WebCache/WebCacheV01.dat
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\Microsoft.ZuneMusic_8wekyb3d8bbwe\MediaPlayer.exe: unsupported file type "irregular"pData/Local/Microsoft/Windows/WebCache/WebCacheV01.dat
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\Skype.exe: unsupported file type "irregular"
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\WindowsPackageManagerMCPServer.exe: unsupported file type "irregular"/Users/admin/AppData/Local/Microsoft/Windows/WebCache/WebCacheV01.dat
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\WindowsPackageManagerServer.exe: unsupported file type "irregular"
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\microsoftstore.exe: unsupported file type "irregular"
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\olk.exe: unsupported file type "irregular"
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\python.exe: unsupported file type "irregular"
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\python3.exe: unsupported file type "irregular"
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\store.exe: unsupported file type "irregular"
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\ubuntu1804.exe: unsupported file type "irregular"
error: C:\Users\admin\AppData\Local\Microsoft\WindowsApps\winget.exe: unsupported file type "irregular"

How can I handle this?