• Api Documentation
  • Source Code
Search Results for

    Show / Hide Table of Contents
    • SharpShellLink
      • Shortcut
    • SharpShellLink.Const
      • KNOWNFOLDERID
    • SharpShellLink.Flags
      • CSIDL
      • CommonNetworkRelativeLinkFlags
      • DriveType
      • FileAttributesFlags
      • FillAttributes
      • FontFamily
      • FontPitch
      • HotKeyFlags
      • LinkFlags
      • LinkInfoFlags
      • ModifierKeys
      • NetworkProviderType
      • ShowCommand
      • VirtualKeyCodes
    • SharpShellLink.PropertyStore
      • IntegerName
      • PropertyType
      • SerializedPropertyStorage
      • SerializedPropertyStore
      • SerializedPropertyValue
      • StringName
      • Structure
      • TypedPropertyValue
    • SharpShellLink.Structures
      • BlockSignature
      • CommonNetworkRelativeLink
      • ConsoleDataBlock
      • ConsoleFEDataBlock
      • CplLinkTargetIDList
      • DarwinDataBlock
      • EnvironmentVariableDataBlock
      • ExtraData
      • ExtraDataBlock
      • IDList
      • IconEnvironmentDataBlock
      • ItemID
      • KnownFolderDataBlock
      • LinkInfo
      • LinkTargetIDList
      • PropertyStoreDataBlock
      • ShellLinkHeader
      • ShimDataBlock
      • SpecialFolderDataBlock
      • StringData
      • Structure
      • TerminalBlock
      • TrackerDataBlock
      • VistaAndAboveIDListDataBlock
      • VolumeID

    Class Shortcut

    The Shortcut class can be used to process & create Shell Link Binary File Format files. In this format a structure is called a shell link, or shortcut, and is a data object that contains information that can be used to access another data object. The Shell Link Binary File Format is the format of Windows files with the extension "LNK".

    Shell links are commonly used to support application launching and linking scenarios, such as Object Linking and Embedding(OLE), but they also can be used by applications that need the ability to store a reference to a target file.

    Inheritance
    object
    Structure
    ShellLinkHeader
    Shortcut
    Inherited Members
    ShellLinkHeader.HeaderSize
    ShellLinkHeader.LinkCLSID
    ShellLinkHeader.Reserved1
    ShellLinkHeader.Reserved2
    ShellLinkHeader.Reserved3
    ShellLinkHeader.FileAttributes
    ShellLinkHeader.CreationTime
    ShellLinkHeader.AccessTime
    ShellLinkHeader.WriteTime
    ShellLinkHeader.FileSize
    ShellLinkHeader.IconIndex
    ShellLinkHeader.ShowCommand
    ShellLinkHeader.HotKey
    ShellLinkHeader.MinimumBlockSize
    Structure.Errors
    Structure.ValidateInputDataSize(int)
    Structure.ValidateHeaderBlockSize(ref byte[], bool)
    Structure.Validate(ref byte[], bool)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: SharpShellLink
    Assembly: SharpShellLink.dll
    Syntax
    public class Shortcut : ShellLinkHeader

    Constructors

    | Edit this page View Source

    Shortcut()

    Constructor

    Declaration
    public Shortcut()

    Properties

    | Edit this page View Source

    ExtraData

    EXTRA_DATA: Zero or more ExtraData structures.

    Declaration
    public ExtraData ExtraData { get; set; }
    Property Value
    Type Description
    ExtraData
    | Edit this page View Source

    LinkFlags

    LinkFlags (4 bytes): A LinkFlags structure that specifies information about the shell link and the presence of optional portions of the structure.

    Declaration
    public override LinkFlags LinkFlags { get; }
    Property Value
    Type Description
    LinkFlags
    Overrides
    ShellLinkHeader.LinkFlags
    | Edit this page View Source

    LinkInfo

    LINKINFO: An optional LinkInfo structure, which specifies information necessary to resolve the link target. The presence of this structure is specified by the HasLinkInfo bit in the ShellLinkHeader.

    Declaration
    public LinkInfo? LinkInfo { get; set; }
    Property Value
    Type Description
    LinkInfo
    | Edit this page View Source

    LinkTargetIDList

    LINKTARGET_IDLIST: An optional LinkTargetIDList structure, which specifies the target of the link. The presence of this structure is specified by the HasLinkTargetIDList bit in the ShellLinkHeader.

    Declaration
    public LinkTargetIDList? LinkTargetIDList { get; set; }
    Property Value
    Type Description
    LinkTargetIDList
    | Edit this page View Source

    ShellLinkHeader

    SHELL_LINK_HEADER: A ShellLinkHeader structure, which contains identification information, timestamps, and flags that specify the presence of optional structures.

    Declaration
    public ShellLinkHeader ShellLinkHeader { get; }
    Property Value
    Type Description
    ShellLinkHeader
    | Edit this page View Source

    Size

    The size of the ShellLink in bytes

    Declaration
    public int Size { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    StringData

    STRING_DATA: Zero or more optional StringData structures, which are used to convey user interface and path identification information. The presence of these structures is specified by bits in the ShellLinkHeader.

    Declaration
    public StringData? StringData { get; set; }
    Property Value
    Type Description
    StringData

    Methods

    | Edit this page View Source

    CreateShortcut(string)

    Create a new Shelllink (shortcut)

    Declaration
    public static Shortcut CreateShortcut(string path)
    Parameters
    Type Name Description
    string path

    Path the shortcut points to

    Returns
    Type Description
    Shortcut

    Shortcut object

    | Edit this page View Source

    CreateShortcut(string, string)

    Create a new Shelllink (shortcut)

    Declaration
    public static Shortcut CreateShortcut(string path, string args)
    Parameters
    Type Name Description
    string path

    Path the shortcut points to

    string args

    Command line arguments

    Returns
    Type Description
    Shortcut

    Shortcut object

    | Edit this page View Source

    CreateShortcut(string, string, int)

    Create a new Shelllink (shortcut)

    Declaration
    public static Shortcut CreateShortcut(string path, string iconpath, int iconindex)
    Parameters
    Type Name Description
    string path

    Path the shortcut points to

    string iconpath

    Path to the file containing the icon

    int iconindex

    Index ot the icon

    Returns
    Type Description
    Shortcut

    Shortcut object

    | Edit this page View Source

    CreateShortcut(string, string, string)

    Create a new Shelllink (shortcut)

    Declaration
    public static Shortcut CreateShortcut(string path, string args, string workdir)
    Parameters
    Type Name Description
    string path

    Path the shortcut points to

    string args

    Command line arguments

    string workdir

    Working directory

    Returns
    Type Description
    Shortcut

    Shortcut object

    | Edit this page View Source

    CreateShortcut(string, string, string, int)

    Create a new Shelllink (shortcut)

    Declaration
    public static Shortcut CreateShortcut(string path, string args, string iconpath, int iconindex)
    Parameters
    Type Name Description
    string path

    Path the shortcut points to

    string args

    Command line arguments

    string iconpath

    Path to the file containing the icon

    int iconindex

    Index ot the icon

    Returns
    Type Description
    Shortcut

    Shortcut object

    | Edit this page View Source

    CreateShortcut(string, string, string, string, int)

    Create a new Shelllink (shortcut)

    Declaration
    public static Shortcut CreateShortcut(string path, string args, string workdir, string iconpath, int iconindex)
    Parameters
    Type Name Description
    string path

    Path the shortcut points to

    string args

    Command line arguments

    string workdir

    Working directory

    string iconpath

    Path to the file containing the icon

    int iconindex

    Index ot the icon

    Returns
    Type Description
    Shortcut

    Shortcut object

    | Edit this page View Source

    FromByteArray(byte[])

    Create a ShellLing from a given byte array

    Declaration
    public static Shortcut FromByteArray(byte[] ba)
    Parameters
    Type Name Description
    byte[] ba

    The byte array

    Returns
    Type Description
    Shortcut

    A Shortcut object

    | Edit this page View Source

    GetBytes()

    Convert the Structure to a byte array

    Declaration
    public override byte[] GetBytes()
    Returns
    Type Description
    byte[]

    Byte array representation of the Structure

    Overrides
    ShellLinkHeader.GetBytes()
    | Edit this page View Source

    ReadFromFile(string)

    Reads a lnk and returns a Shortcut object

    Declaration
    public static Shortcut ReadFromFile(string path)
    Parameters
    Type Name Description
    string path

    Path to the lnk file

    Returns
    Type Description
    Shortcut

    Shortcut object

    | Edit this page View Source

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    ShellLinkHeader.ToString()
    | Edit this page View Source

    WriteToFile(string)

    Writes Shortcut object to a file

    Declaration
    public void WriteToFile(string path)
    Parameters
    Type Name Description
    string path

    Target lnk path

    • Edit this page
    • View Source
    In this article
    Back to top Copyright (c) 2017 Securify B.V., 2026 Jérémy Ansel