0

Run from Admin this code works in Windows XP.

set app=ExtrNS.exe
set nam=ExtrNS@
REG ADD "HKLM\SOFTWARE\Classes\Directory\shell\%nam%\command" /v "" /t REG_SZ /d """"%CD%\ExtrNS.exe""" """%%1"" /f

In Windows 7, the result is not the home directory, but "C:\Windows\ExtrNS.exe" "%1"

1 Answer 1

0

The result is not the home directory, but is "C:\Windows\ExtrNS.exe" "%1"

%CD% has the value of the the current directory, which will be the directory from where the batch file is executed.

If you want the user's "Home Directory", use %UserProfile% instead of %CD%.


By home I meant where the .exe file is not the user's home directory

The easiest way to do this is to include the path of the .exe file as part of the app variable:

set app=c:\path_to_appp\ExtrNS.exe
  • Change path_to_app as appropriate for your computer.
  • Remove %CD%\ as it is now not needed.

Standard (built-in) Environment Variables

  • CD - The current directory (string).

  • USERPROFILE - %SystemDrive%\Users\{username}

    This is equivalent to the $HOME environment variable in Unix/Linux

Source Windows Environment Variables


Further Reading

2
  • now i got that "C:\Users\n1ke\ExtrNS.exe" "%1" sry my eng, but i mean home where exe file.
    – soft0nut
    Jul 25, 2015 at 8:20
  • @soft0nut Answer updated.
    – DavidPostill
    Jul 25, 2015 at 8:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .