C#不引用IWshRuntimeLibrary获取快捷方式目标位置
2021-01-16 09:13
标签:rom get instance targe cut stat new static release private static readonly Guid CLSID_WshShell = new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8"); C#不引用IWshRuntimeLibrary获取快捷方式目标位置 标签:rom get instance targe cut stat new static release 原文地址:https://www.cnblogs.com/BluePointLilac/p/12228470.html
private static string GetShortCutTarget(string lnk) {
if (System.IO.File.Exists(lnk)) {
dynamic objWshShell = null, objShortcut = null;
try {
objWshShell = Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_WshShell));
objShortcut = objWshShell.CreateShortcut(lnk);
return objShortcut.TargetPath;
}
finally {
Marshal.ReleaseComObject(objShortcut);
Marshal.ReleaseComObject(objWshShell);
}
}
return null;
}// 获取快捷方式目标路径
文章标题:C#不引用IWshRuntimeLibrary获取快捷方式目标位置
文章链接:http://soscw.com/index.php/essay/42649.html