Search code examples
windows-7windowregistryregedit

How to use writing %~dp0 to Registry suing REG_SZ?


I need to add use %~dp0 to Registry suing REG_SZ in a register entry.

With the following code the app does not run at startup.

Could you point me out what am I doing wrong here?

   Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
    "Gate"="%~dp0 C:\\wamp\\www\\xxx\\trunk\\xxxClient\\xxxClientWPF\\xxxClientWPF\\bin\\Debug\\xxxClientWPF.exe"

Solution

  • Try removing the space.

    "Gate"="%~dp0 C:\\wamp\\www\\xxx\\trunk\\xxxClient\\xxxClientWPF\\xxxClientWPF\\bin\\Debug\\xxxClientWPF.exe"
    

    should read like this.

    "Gate"="%~dp0C:\\wamp\\www\\xxx\\trunk\\xxxClient\\xxxClientWPF\\xxxClientWPF\\bin\\Debug\\xxxClientWPF.exe"
    

    see if this works.