Search code examples
windowsbatch-fileregistry

Process %1 to registry in batch script


I need to add this value %~dp0scss-formatter.bat %1 (%~dp0 is folder path) and that part %1 should saved to this value too (not as file name, but string). My whole .bat file looks like this:

@echo off
reg add "HKEY_CLASSES_ROOT\scss_auto_file\shell\SCSS Format\command" /ve /t REG_SZ /d "%~dp0scss-formatter.bat %1" /f

It works well, except that %1. In default value I need that %1, so, is here any way how to do it? I mean, in registry that key will have default value, for example: D:\Applications\scss-formatter.bat %1.


Solution

  • I found it. Instead of %1 use %%1.