Not Able To Execute Files With Spaces In Path

My domain is:

I ran these commands:
cd "C:\Users\Kyle Unrau\Documents\Web Services\Nameserver\Assets\Executables"
certbot renew --dry-run --manual-auth-hook CertificateRenewal.bat

It produced this output:

Failed to renew certificate with error: manual-auth-hook command CertificateRenewal.bat exists, but is not executable.

My web server is: Custom Build (i.e., NodeJS HTTP/HTTPS Server)
My name server is: Custom Build (i.e., NodeJS DNS Server)

The operating system my web server runs on is: Windows 10

My hosting provider is: GoDaddy (Not relevant)

I can login to a root shell on my machine: Yes

I'm using a control panel to manage my site: No

The version of my client is: 1.24.0

Hi, I was looking at the forums and I wasn't able to find anything regarding my issue. I've been attempting to call a .bat file to take the environmental variables given by Certbot to communicate with a NodeJS server and was able to successfully communicate the validation keys to the server which is all that I need to update the acme-challenge TXT file. The only issue I've ran into and haven't been able to figure out is how I would be able to call that .bat file given that the path of that file includes space characters. I've tried a number of ways to get around this issue and none have seemed to work except if the path doesn't include any spaces and I was hoping someone could shed some light on how I could work around this.

I initially tried to simply set up the manual auth hook by using double quotation marks around the file name; however, it seems as though Certbots command-line is somewhat primitive in that arguments are simply divided by a space character without regard for double quotation marks. I tried using the command:
certbot renew --dry-run --manual-auth-hook "C:\Users\Kyle Unrau\Documents\Web Services\Nameserver\Assets\Executables\CertificateRenewal.bat"
but when I do it returns the error

Failed to renew certificate with error: Unable to find manual-auth-hook command C:\Users\Kyle in the PATH

suggesting that the first space character it encounters cuts off the remaining path. To try and work around this I have also tried using a caret (^) to try and escape the space character as well as backtick/grave accent (`) but I have not been able to find a way to call the .bat file using an escape character. My last solution that I thought could have worked was to use the "cd" command to reference the files respective parent folder by executing the command:
cd "C:\Users\Kyle Unrau\Documents\Web Services\Nameserver\Assets\Executables"
and then running the command:
certbot renew --dry-run --manual-auth-hook CertificateRenewal.bat
which ended up giving me a new error I had not seen before saying

Failed to renew certificate with error: manual-auth-hook command CertificateRenewal.bat exists, but is not executable.

which confused me as the .bat file is executable and does run successfully given the path does not include any space characters. It was my assumption that Certbot has limited support for space characters on a Windows operating system but I just wanted to verify on the community forums if anyone has any suggestions or answers regarding this matter so I don't have to rename my folders with space characters (including my user directory folder [C:\Users\Kyle Unrau]) and all references to files within those folders.

Any help would be greatly appreciated as I've been trying to figure this issue out for a little too long and don't want to try looking for alternatives to Certbot.


I don't have any good answers. Probably need to wait for a certbot dev to comment.

When you tested doing a cd before certbot to avoid naming path for hook did you try specifying it as .\CertificateRenewal.bat? I know I need to add .\ with powershell if the script is in current folder but not also in path. Just a guess.

Also, why would you have to change all your folder names? Couldn't you just put the hook file in a "non-spaced" folder? I don't know if certbot also requires the folder to be in PATH


Thank you so much, using the .\ before the file name worked perfectly. I'm extremely new to batch files/powershell as well as Certbot so I apologize if my question seemed rather stupid.

But the problem I had was that all my files were located within my documents folder and I wanted to keep everything together (i.e., not have executables in obscure locations) in-case I needed to transfer my files to another server and for backing-up the files and also didn't want to go about relocating all my files as many file references within my server are static and moving them would be a hassle to fix.

1 Like

No worries. That was a long-shot guess on my part. Glad it worked out.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.