The first item in the argument list is the name of the executable to run. It's what you would type if you opened command prompt to run file explorer. For example you might run the following in command prompt:
explorer C://Users/
The command prompt splits up what you type into a list, where the first argument is the process to run (explorer
) and the rest are the arguments to send to that process (['C://Users/']
). When you use subprocess.run
in python, it doesn't automatically split up what you enter, so you need to give it a list of arguments directly.
Whoever wrote that code you found knew that explorer
was the name of the process to run to launch the file explorer. Sometimes finding the command to run to launch a certain process can be tricky in windows - task manager might be able to give that information if you find a process that's already running, I'm not sure.