Rundll and rundll32 allow you to invoke a function exported from a DLL.
' rundll32 interfacing demo
' compile as rundlldemo.dll
' from the command prompt execute following command
' rundll32 rundlldemo.dll,PlayFile %windir%\media\tada.wav
export PlayFile
export PlayFileW ' if the 'W' version is exported, it will be called first on NT platforms
sub PlayFile(int hwnd, int hinst, string lpszCmdLine, int nCmdShow)
'MessageBox 0, lpszCmdLine, "PlayFile"
PlayWave lpszCmdLine, @SNDSYNC
endsub
sub PlayFileW(int hwnd, int hinst, wstring lpszCmdLine, int nCmdShow)
'MessageBox 0, w2s(lpszCmdLine), "PlayFileW"
PlayWave w2s(lpszCmdLine), @SNDSYNC
endsub
http://support.microsoft.com/default.aspx?scid=KB;EN-US;q164787&
Really I didn't know how it works, always assumed the dll function calls GetCommandLine and checks if process name is rundll32.