I'm trying to launch a windows with python. I've tried NUMEROUS approaches with os.system, subprocess.call, os.startfile etc. but I'm always getting an error saying that the path does not exist.
I know that the path is correct because I've tried running the following command in CMD.EXE:
start D:\johan\programmering\Scripts\shortcuts\HWMonitor.lnk
Here is some of the stuff I've tried without success:
os.startfile(r"D:\johan\programmering\Scripts\shortcuts\HWMonitor.lnk")
os.startfile("D:\\johan\\programmering\\Scripts\\shortcuts\\HWMonitor.lnk")
subprocess.call("D:\\johan\\programmering\\Scripts\\shortcuts\\HWMonitor.lnk")
subprocess.call(r"D:\johan\programmering\Scripts\shortcuts\HWMonitor.lnk")
subprocess.Popen(r"D:\johan\programmering\Scripts\shortcuts\HWMonitor.lnk")
subprocess.Popen(r"D:\johan\programmering\Scripts\shortcuts\HWMonitor.lnk", shell=True)
os.system(r"start D:\johan\programmering\Scripts\shortcuts\HWMonitor.lnk")
p= subprocess.Popen(r"start D:\johan\programmering\Scripts\shortcuts\HWMonitor.lnk", shell=True)
p.wait()
import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut(r"D:\johan\programmering\Scripts\shortcuts\HWMonitor.lnk")
subprocess.call(shortcut.Targetpath)
DISCLAIMER I know that there are similar questions asked on SO, but none of them have helped me. So before you start crying "duplicate!" please know that I've tried the solutions with no success.