reg add "HKCR\Applications\myapp.exe\shell\open\command" /ve /t REG_EXPAND_SZ /d "\"^%MYAPPSDIR^%\myapp.exe\" \"^%1\"" /f
Nota:
- para evitar a expansão de
%MYAPPSDIR%pelo interpretador de linha de comando, o caractere%porcento deve ter o escape do caractere de escape padrãoCLI(^caret):^%MYAPPSDIR^%; - para incluir uma marca de aspas
"nos dados, prefixe-os com o caractere de escapereg(\barra invertida). Por exemplo.\"aqui é uma citação, pois o comandoREGinterpretará\como uma fuga para o caractere que o segue imediatamente.
Um exemplo ( copy&paste da minha linha de comando administrador ):
C:\Windows\system32>reg query "HKCR\Applications\mspaint.exe\shell\edit\command" /ve
HKEY_CLASSES_ROOT\Applications\mspaint.exe\shell\edit\command
(Default) REG_EXPAND_SZ "%systemroot%\system32\mspaint.exe" "%1"
C:\Windows\system32>reg add "HKCR\Applications\mspaint.exe\shell\edit\command" /ve /t
REG_EXPAND_SZ /d "\"^%systemroot^%\system32\mspaint.exe\" \"^%1\"" /f
The operation completed successfully.
C:\Windows\system32>reg query "HKCR\Applications\mspaint.exe\shell\edit\command" /ve
HKEY_CLASSES_ROOT\Applications\mspaint.exe\shell\edit\command
(Default) REG_EXPAND_SZ "%systemroot%\system32\mspaint.exe" "%1"