且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在由快捷方式启动的程序中获取(.lnk)快捷方式文件路径?

更新时间:2021-07-01 22:56:54

在本机代码中,您可以调用 GetStartupInfo,如果 STARTF_TITLEISLINKNAME 位在 STARTUPINFO.dwFlags 中设置,则路径.lnk 在 STARTUPINFO.lpTitle 中.我不知道是否有 .NET 方式来获取此信息,您可能必须 P/Invoke ...

In native code you can call GetStartupInfo, if the STARTF_TITLEISLINKNAME bit is set in STARTUPINFO.dwFlags then the path to the .lnk is in STARTUPINFO.lpTitle. I don't know if there is a .NET way to get this info, you probably have to P/Invoke...