Archive: calling folder/path/prompt from command line


calling folder/path/prompt from command line
i need to determine the path from the calling command line window. anyone has hints?


The question makes no sense, I could be at c:\foo in cmd.exe and run ..\bar\yoursetup.exe, how would knowing about c:\foo be useful?

To do it involves finding the parent process and reading its PEB but you are now in undocumented land. It would be less hacky to inject a thread that calls GetCurrentDirectory but that still leaves the issue of dealing with a 64bit parent...


i have small tool laid in c:\windows but i want to call it from command line anywhere. parameter is a folder name - but it can be only a name from a subfolder or full path. if only subfolder i need to determine the calling folder otherwise it would handle the wrong folder.

it doesnt matter if i call it from context menu oder sendto - there is given the full path but not in command line window.


Are you just looking for this

!include FileFunc.nsh
${GetParent} $CmdLine $0
DetailPrint $0

You could try calling GetFullPathName with the system plugin...