I have a .inf file for installing a service. The path of the installation contains spaces. I want to quote them, for avoiding security issues.
Currently, the inf has these lines:
ServiceBinary = %10%\path\with sub folder that contains spaces\myservice.exe
and
[DestinationDirs]
DefaultDestDir = 10,path\with sub folder that contains spaces
So in order to the service appear with quotes here: HKLM\SYSTEM\CurrentControlSet\Services\myservice\ImagePath
I have changed ServiceBinary
, as mentioned here.
I have tried all of these but with no success:
ServiceBinary = "%10%\path\with sub folder that contains spaces\myservice.exe"
ServiceBinary = ""%10%\path\with sub folder that contains spaces\myservice.exe""
ServiceBinary = %10%""\path\with sub folder that contains spaces\myservice.exe""
Do you know what should I change in my .inf file, so the service's exe path will be quoted in the registry (and service's Path to Executable property as well)?
Thanks!
So I have found the answer...
[DestinationDirs]
DefaultDestDir = 10,""path\with sub folder that contains spaces""
and
ServiceBinary = """%10%\path\with sub folder that contains spaces\myservice.exe"""
Pay attention to the three(!) quotation marks for ServiceBinary
.
You can see Microsoft docs for more info.