简体   繁体   中英

Windows cmd in python using os.system() not working with VLC commands

I've registered VLC media player as a system variable so when I type vlc into commandline it opens no matter what. I'm trying to write a python program which gives vlc a filename to open in fullscreen but i cant even get python to open vlc using os.system() (I know python has a vlc module, I'm learning about how to use os.system() though)

this is what I'm currently trying to run

import os

cmd = 'vlc'
print (cmd)
os.system(cmd)

the python shell opens and prints the 'vlc', and a command window pops up for a moment and disappears.

Any help would be appreciated :)

On Windows.

os.system("C:/Program Files (x86)/VideoLAN/VLC/vlc.exe") #Or mention your vlc.exe path 

Using subprocess to open vlc player

p = subprocess.Popen(["C:/Program Files (x86)/VideoLAN/VLC/vlc.exe"])   #Or mention your vlc.exe path 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM