Python Forum
how to run a file in powershell with python
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to run a file in powershell with python
#2
You are mixing things up. To run your program you basically have two choices:
1) You need to navigate to the directory containing you file. then type the entire file name including the ".py"

For example

PS C:\Users\sparkz> cd c:\python
PS C:\python>ex1.py
2) In file explorer, navigate to your file and double-click it.
Notice your prompt is "PS C:\"
To use python in interactive mode, type "python" (if you have one version of python installed)

For example:

PS C:\> python
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Notice in this mode, your prompt is now ">>>"

To exit this mode and return to the command prompt, type "exit()" then Enter
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Messages In This Thread
RE: how to run a file in powershell with python - by sparkz_alot - Jun-26-2017, 04:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  using PowerShell from Python script for mounting shares tester_V 8 580 Mar-12-2024, 06:26 PM
Last Post: tester_V
  PowerShell & Python deep_logic 2 736 Jun-06-2023, 06:34 AM
Last Post: buran
  How to write a part of powershell command as a variable? ilknurg 2 1,146 Jul-26-2022, 11:31 AM
Last Post: ilknurg
Photo Windows 10 PowerShell doesn't work Amy 3 3,950 Apr-27-2021, 01:33 PM
Last Post: jefsummers
  Powershell Session translation to Python; Session code seems to not work Maverick494 1 3,631 Jun-26-2018, 05:16 PM
Last Post: Maverick494
  virtualenv on powershell mcmxl22 3 6,449 Feb-08-2017, 06:29 AM
Last Post: snippsat
  Cant Get Powershell to run a python program from notepad++. Newbie help! Pythonerous 4 8,984 Oct-10-2016, 07:16 PM
Last Post: Pythonerous

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020