是Python可以做到這一點在許多方面:
1.Via模塊,如webbrowser:
url = 'http://www.python.org/'
# Open URL in a new tab, if a browser window is already open.
webbrowser.open_new_tab(url + 'doc/')
# Open URL in new window, raising the window if possible.
webbrowser.open_new(url)
2.Via os.system
或subprocess.call
:
import os
os.system("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -ArgumentList @('-incognito', 'www.site.com'")
3.Via PowerShell的,但就是有點矯枉過正一個
import subprocess
subprocess.call(["C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe", ". \"./SamplePowershell\";", 'Start-Process "chrome.exe" "www.google.com"'])
是Python可以做到這一點 – Veltro
對於額外工作進程,子進程是很好的方法 - https://pymotw.com/2/subprocess/ – anatol