= rdiff-backup: {page-name}
:page-name: Windows Usage
:pp: {plus}{plus}
:sectnums:
:toc: macro

link:.[Home,role="button round"] // *{page-name}*

'''''

toc::[]


== Installation

To install the provided binary, simply copy _rdiff-backup.exe_ to someplace in your *PATH*.
Everything is included in the binary (including Python) for local operation.
For remote operation, you will need to install a Windows SSH program.
You will also need to install _rdiff-backup_ on the remote system(s).

NOTE: you might want to https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation#enable-long-paths-in-windows-10-version-1607-and-later[enable long paths support in Windows 10 v1607 or later].
A simple alternative from the command line is to query the long path support with `reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled` (the result will be `0x0` for disabled or `0x1` for enabled), and enable it with `reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f`.

== Additional Issues

=== include and exclude paths

Currently, _rdiff-backup_'s `--include` and `--exclude` options do not support Windows paths with `\` as the directory separator.
Instead, it is necessary to use `/` which is the Unix directory separator.

=== Too old version of Windows

If trying to start rdiff-backup, you get a dialog:

____
The program can't start because api-ms-win-core-path-l1-1-0.dll is missing from your computer.
Try reinstalling the program to fix this problem.
____

And then on the command line something like:

____
Error loading Python DLL 'C:\Users\myuser\AppData\Local\Temp\_MEI395202\python39.dll
LoadLibrary: The specified module could not be found.
____

Then you're most probably running a version of Windows not supported by the version of Python embedded in `rdiff-backup.exe`.
The release notes and/or the installation instructions should give you the necessary information, else check the https://www.python.org/downloads/windows/[Python for Windows download page].

== Troubleshooting

If you have everything installed properly, and it still doesn't work, see the enclosed manual, FAQ, the web page at https://rdiff-backup.net, and/or the mailing list.
You can subscribe to the mailing list at: https://lists.nongnu.org/mailman/listinfo/rdiff-backup-users

You can also try searching the mailing list archives: https://lists.nongnu.org/archive/html/rdiff-backup-users/

== Tips and Tricks

=== Using Putty as SSH client

If you have Putty installed (and configured) and don't want to fiddle with OpenSSH, add the following parameter to your rdiff-backup call:

----
--remote-schema "plink.exe -i D:\backup-key.ppk -batch %s rdiff-backup server"
----

* `-batch` avoids having to press enter to open the session
* `-i` lets you specify a puttygen-generated private key

=== Using Microsoft's OpenSSH client on Windows 10

If rdiff-backup can't seem to find the native SSH client offered by Windows, even if it is definitely in your PATH (as proven by `where ssh`), and even if you use the full path `C:\Windows\System32\OpenSSH\ssh.exe`, it's most probably because you're using the 32 bits version of rdiff-backup on a 64 bits Windows, they just don't see this path.

You have two solutions:

. install the 64 bits version of rdiff-backup.
. add the remote schema option to your call of rdiff-backup with something like `--remote-schema "C:\Windows\SysNative\OpenSSH\ssh.exe %s rdiff-backup server"` (adding the path to the front of your PATH environment variable might also be an option).

=== Create a bat script to call rdiff-backup

Create a file `rdiff-backup.bat` somewhere in your `PATH`.
The content can be as simple as the following:

----
C:\FULLPATH\rdiff-backup.exe -v5 -b --exclude-globbing-file "%~dpn0.txt" source target
----

so that you can put your exclusion patterns in a file called `rdiff-backup.txt` placed in the same directory as your bat-script.

TIP: if you set the remote-schema in your bat-script, don't forget to duplicate the percentage sign to `%%s`, so that the bat-interpreter doesn't "interpret" it as variable.
