title: Run python scripts from any folder under powershell in windows
body: <p>I have a folder of python scripts which I'd like to run from any folder under windows. As a python interpreter I am running Python 3.6 installed with Miniconda.</p>
  
  <p>For example in the folder <code>C:\Users\name\my_scripts</code> I have a script called <code>test.py</code> with the following content.</p>
  
  <pre><code>print('test')
  </code></pre>
  
  <p>After navigating to the folder running the script works by executing it with python producing the following output.</p>
  
  <pre><code>PS C:\Users\name\my_scripts&gt; python test.py
  test
  
  PS C:\Users\name\my_scripts&gt; cd..
  PS C:\Users\name&gt; python test.py
  C:\Users\name\Miniconda3\python.exe: can't open file 'test.py': [Errno 2] No such file or directory
  </code></pre>
  
  <p>I tried adding <code>C:\Users\name\my_scripts</code> to <code>Path</code> . Typing <code>test.py</code> in any folder in powershell opens the script with my default text editor, but executing the script with <code>python test.py</code> form anywhere but the script folder results in a file not found error.</p>
  
  <p>Creating a <code>%PYTHONPATH%</code>environment variable containing the script folder did not work neither. As far as I understand the this is normal as this environment variable is supposed to be used to import modules from specific locations, but not to execute modules by themselves.</p>
  
  <p>Is there a way to execute the scripts in the <code>my_scripts</code> folder from any given location?</p>