Search code examples
shortcutrundll32

Call dll which is in folder other than system32


I want to call my dll through a shortcut, but I need to identify the current directory the dll is in.

At the moment I can only call it this way: C:\Windows\System32\rundll32.exe C:\Users\Public\BUS.dll, print

And I would like to call her that: C:\Windows\System32\rundll32.exe BUS.dll, print

I need a command that returns the current directory and calls the dll


Solution

  • Assuming that your current directory is the one where bus.dll resides, you can modify the command as follows:

    C:\Windows\System32\rundll32.exe %cd%\BUS.dll
    

    %cd% is the Windows cmd variable for the current directory (Reference).