question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create PowerShell shortcut similar to "WinPython Command Prompt.exe"

See original GitHub issue

Summary:

Create a shortcut to a PowerShell session with all of the environment variables set already.

Reasoning:

Windows PowerShell is a more powerful, more feature-rich, and more customizable shell than the command prompt, cmd.exe (especially in Windows 10 which added even more goodies).

Implementation Issues:

The only issue I can think of right now is that, by default, Windows restricts powershell scripts from running.

  • Option 1: Run Set-ExecutionPolicy RemoteSigned or Set-ExecutionPolicy Unrestricted in powershell before running the script. This, however, requires administrator privileges which (in my opinion) goes against one of the primary benefits of WinPython.
  • Option 2: You can run the powershell script via powershell -ExecutionPolicy ByPass -File '.\WinPython Command Prompt (PowerShell).ps1'. But in order to do that you must already have a PS window open. Not a big deal, but it means that it’s a 2-step process.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:15 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
warren-bankcommented, Jan 21, 2019

sorry to bump an old thread… especially since this comment is fairly obvious… but it’s probably worth mentioning…

for those of us who

  • dislike PowerShell
  • like bash
  • use git for windows… and already have a bash shell available

it’s super easy to run python, pip, etc from bash…

  • make a new file python-bash.cmd in a directory that’s in PATH
  • configure to match how you organize your directories:
      @echo off
    
      set winpython_home=C:\PortableApps\WinPythonZero\3.7.1.0
      set portablegit_home=C:\PortableApps\git\2.16.2\PortableGit
    
      call "%winpython_home%\scripts\env.bat"
    
      start "bash" "%portablegit_home%\git-bash.exe" %*
    
0reactions
dougthor42commented, May 31, 2016

Sorry for the delayed response.

should I duplicate $env:HOME value to $HOME

I’m not much of a PS guru either, but my initial thought is no, you don’t need to duplicate them.

value-addition

I agree! Default CMD/PS sizes are far too small…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to change default directory for WinPython ...
The exe runs cmd.bat in the scripts directory. ... shortcut with the Target: "C:\WPy64-3870\WinPython Command Prompt.exe" cd /d d:\python.
Read more >
How do I make a Windows shortcut run an exe in ... - Super User
With Command Prompt, you can just make a .bat or .cmd file and it works out of the box. With PowerShell, you make...
Read more >
Using Python for scripting and automation | Microsoft Learn
Enter Terminal: Select Default Shell and a list of terminal options will display containing PowerShell, Command Prompt, WSL, etc. Select the one ...
Read more >
Creating a Stand Alone Executable from a Python Script using ...
We will use PyInstaller to convert .py to . exe. ... Linux Command Line Tutorials ➡️ http://bit.ly/2IXuil0 ⚫️ http://bit.ly/2IXukt8 C ...
Read more >
4. Using Python on Windows — Python 3.11.1 documentation
Create shortcuts for the interpreter, documentation and IDLE if installed. ... Alternatively, it will be available from any Command Prompt or PowerShell ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found