3

this may seem basic, but could somebody run me through how to run a python file (one that's already created), through powershell? I know absolutely nothing about powershell despite hours of looking online to learn

Thanks all

2

2 Answers 2

1

It is happily very similar, if not the same, as running a python script from the normal command line.

First you're going to need to have python installed and in your path. To test this try python --version in powershell. You should get output like: python 2.7.

If that worked fine then you run your script by typing python followed by the script name i.e. python test.py (if its in another directory you will need to go to that dir or add the dir to the filename).

If that didn't work you probably need to install python: https://www.python.org/

Sign up to request clarification or add additional context in comments.

4 Comments

thank you, that helped more than you might think lol.... now would you happen to know how you can write a powershell script as well?
im not even sure if that question made sense... that's how bad I am at powershell @Scheme
@python_beginner_coder Sure that made sense, everyone starts somewhere. a basic powershell script is simple enough but it is hard to explain in a comment! take a look here: pdq.com/blog/…
@python_beginner_coder A useful thing to remember is everything is run in a linear way, logically. Things execute in order, almost strictly, in powershell scripts. For example, there are not function prototypes unless you write them in an alternate file and import them at the top of the script you're writing your logic in.
0

Provide the path where you have installed the Python, followed by the path of the Python script:

'path of python.exe' 'Path of the python script'

Example:

C:\\Python27\python.exe 'D:\\Project\script.py'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.