def read_scexec(scfile):
""" read shortcut and return executable path """
if sys.platform != 'win32':
return "Only available for windows platforms! returning"
try:
import pythoncom
from win32com.shell import shell, shellcon
except:
return "pythoncom module not found! \n download from http://sourceforge.net/projects/pywin32/files/pywin32/"
shortcut = pythoncom.CoCreateInstance (
shell.CLSID_ShellLink,
None,
pythoncom.CLSCTX_INPROC_SERVER,
shell.IID_IShellLink
)
shortcut.QueryInterface (pythoncom.IID_IPersistFile).Load (scfile, 0)
cmd, _ = shortcut.GetPath (shell.SLGP_UNCPRIORITY)
args = shortcut.GetArguments ()
work_dir = shortcut.GetWorkingDirectory()
return "Executing " + cmd, cmd, args, work_dir, False, False
评论列表
文章目录