Alex
Alex

Reputation: 1934

%1 is not a valid Win32 application (lnk file)

I have this script in python

import subprocess

subprocess.call( 'pathtofile/file.lnk')

and i got this error

WindowsError: [Error 193] %1 is not a valid Win32 application

I find out that it needs exe files in order to work.Is there any way that i can do it with lnk and mdb files?

Upvotes: 0

Views: 313

Answers (1)

Erik Cederstrand
Erik Cederstrand

Reputation: 10220

You cannot execute a shortcut or an mdb file. You probably want to do the equivalent of double-clicking the file in Windows. This opens the file in the default application.

To do that, you can use os.startfile()

Upvotes: 3

Related Questions