如何在 Linux 上從 Windows *.lnk 捷徑轉儲資訊?

如何在 Linux 上從 Windows *.lnk 捷徑轉儲資訊?

要在 Linux 上啟動 Windows lnk 快捷方式,可以使用wine start qqq.lnk.

但我是否查看有關它的資訊(命令列、當前目錄)?strings是不足夠的。

答案1

似乎沒有很多程式可以做到這一點...我發現了兩個可以工作的 Perl 腳本。

lslnk.pl墨水解析

像這樣使用它們:<whicheverscript> Name.lnk

答案2

您可以使用該lnkinfo工具庫連結liblnk-utilsDebian 中的包):

lnkinfo <file.lnk>

腳本中的用法範例:

LOCAL_PATH=$(lnkinfo "$1" | grep 'Local path' | cut -d':' -f2-)
ARGS=$(lnkinfo "$1" | grep 'Command line arguments' | cut -d':' -f2-)

輸出範例:

$ lnkinfo 'Program Files - Shortcut.lnk'
lnkinfo 20171101

Windows Shortcut information:
        Contains a link target identifier
        Contains a relative path string

Link information:
        Creation time           : Jul 14, 2009 03:20:08.555426400 UTC
        Modification time       : Apr 23, 2019 21:36:46.017274100 UTC
        Access time         : Apr 23, 2019 21:36:46.017274100 UTC
        File size           : 12288 bytes
        Icon index          : 0
        Show Window value       : 0x00003000
        Hot Key value           : 12288
        File attribute flags        : 0x00000011
                Is read-only (FILE_ATTRIBUTE_READ_ONLY)
                Is directory (FILE_ATTRIBUTE_DIRECTORY)
        Drive type          : Fixed (3)
        Drive serial number     : 0x0e1909c6
        Volume label            : Local Disk
        Local path          : C:\Program Files
        Relative path           : ..\..\..\Program Files

Link target identifier:
        Shell item list
                Number of items     : 3

        Shell item: 1
                Item type       : Root folder
                Class type indicator    : 0x1f (Root folder)
                Shell folder identifier : 20d04fe0-3aea-1069-a2d8-08002b30309d
                Shell folder name   : My Computer

        Shell item: 2
                Item type       : Volume
                Class type indicator    : 0x2f (Volume)
                Volume name     : C:\

        Shell item: 3
                Item type       : File entry
                Class type indicator    : 0x31 (File entry: Directory)
                Name            : PROGRA~1
                Modification time   : Apr 23, 2019 21:36:48
                File attribute flags    : 0x00000011
                        Is read-only (FILE_ATTRIBUTE_READ_ONLY)
                        Is directory (FILE_ATTRIBUTE_DIRECTORY)
        Extension block: 1
                Signature       : 0xbeef0004 (File entry extension)
                Long name       : Program Files
                Localized name      : @shell32.dll,-21781
                Creation time       : Jul 14, 2009 03:20:10
                Access time     : Apr 23, 2019 21:36:48
                NTFS file reference : MFT entry: 878, sequence: 1



Distributed link tracking data:
        Machine identifier      : <snip>
        Droid volume identifier     : b2638d5e-f5b8-480c-bda0-fdb25ab91131
        Droid file identifier       : 968b84a2-a646-11e9-a124-0021cc6948e3
        Birth droid volume identifier   : b2638d5e-f5b8-480c-bda0-fdb25ab91131
        Birth droid file identifier : 968b84a2-a646-11e9-a124-0021cc6948e3

答案3

問題並沒有說你使用 cygwin,但如果是這樣,我建議使用 Cygutils 套件附帶的 readshortcut

注意:我發現了一些它不顯示的快捷方式,所以我也建議使用暴力破解

字串-el

甚至

十六進位轉儲-c

READSHORTCUT(1) Cygutils
READSHORTCUT(1)

名稱 readshortcut - 從 Windows 捷徑 (.lnk) 檔案讀取數據

摘要閱讀快捷方式 [選項]* 快捷方式

說明 readshortcut 是用於讀取 Windows 捷徑檔案(也稱為 OLE 連結)的命令列工具。最實際的用途是解析快捷方式指向的目標。它可以輕鬆地從腳本或批次檔運行以進行非互動式使用。

相關內容