I currently have the following code under C:\Users\MyName\Desktop\test.py
import subprocess
command='Set-Location new_folder'
subprocess.Popen('powershell -command '+"'"+command+"'", shell=True)
What I want this to do is for the
1. "Set-Location new_folder" to be written
2. And the 'Set-Location new_folder' command is executed and the currently directory is set to new_folder, such as "C:\Users\MyName\Desktop\new_folder"
However, this is not so and just the words are inputted and doesn't react, like the picture below:
It can be seen that the one above is not colored in yellow, and the one below is colored in yellow. The yellow one is the one I hand-coded "Set-Location new_folder", which actually works and changes the directory to the new_folder. The above one which is not colored in yellow is when I executed from the python script, and the powershell doesn't recognize it as a command...
How to fix this?