Created
September 25, 2017 17:58
-
-
Save wonderstory/45c591a86b3b753cd427270cb0c79111 to your computer and use it in GitHub Desktop.
handle windows shortcut file (.lnk)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// refer to COM -- Windows Script Host Object Model | |
var lnkPath = @"C:\hoge\hoge.lnk"; | |
var shell = new IWshRuntimeLibrary.WshShell(); | |
var shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(lnkPath); | |
// operations | |
//shortcut.FullName | |
//shortcut.TargetPath | |
//shortcut.Arguments | |
// dispose objects | |
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(shortcut); | |
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(shell); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment