Giter Site home page Giter Site logo

tobysmith568 / run-in-powershell Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 959 KB

VS Code extension to run Powershell scripts in a terminal external to VS Code

Home Page: https://marketplace.visualstudio.com/items?itemName=tobysmith568.run-in-powershell

License: ISC License

TypeScript 78.73% PowerShell 2.55% JavaScript 18.72%
vscode vscode-extension powershell powershell-scripts powershell-core terminal typescript pwsh

run-in-powershell's Introduction

Run-in-Powershell

This extension allows you to run .ps1 files in a powershell terminal external to VS Code.

Features

  • Run files in terminals external to VS Code
  • Optionally use Powershell Core
  • Optionally run the terminal with admin privileges

File Context Menu

You can run your .ps1 scripts in terminals external to VS Code by using the file context menu.

GIF showing how to use the context menu functionality of this extension

Editor Title

You can also run the commands from the editor title

Image showing how to use the editor title functionality of this extension

Powershell Core

To use Powershell Core, configure the location of your .exe in the settings, else leave it empty.

Image showing how to enable Powershell Core in this extension

License

Run-in-Powershell is licensed under the ISC License.

Run-in-Powershell is protected by License Cop.

Icons by Icons8.

run-in-powershell's People

Contributors

dependabot[bot] avatar imgbotapp avatar renovate[bot] avatar tobysmith568 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

andrewdbond

run-in-powershell's Issues

Support for path with spaces

I've been a happy user of your extension. It works great and adds on top of native PowerShell Preview extension and helps me greatly.

However, it seems to have a problem with the path contains spaces.

image

Thank you

How to start Windows PowerShell x64?

It is easily possible to start Powershell 7 (x64) with the entry C:\Program Files\PowerShell\7\pwsh.exe under PowerShell Core Location.

But how do I start PowerShell (x64)? Neither the entry C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe nor the entry C:\Windows\syswow64\WindowsPowerShell\v1.0\powershell.exe are successful. The 32-bit version is always started. And there, for example, the registry looks quite different. A script that should run under Windows 64-bit cannot be tried then. Unfortunately. Because I find this extension pretty great.

Operating system: Windows 10 64-bit.

Configuration options.

This extension is a great start. In order for it to be something I can use, I need to be able to define configurations besides the two that come by default.

Right off the bat, I need to be able to pass parameters captured by VSCode via ${command:SpecifyScriptArgs}.
I also need the profile to load sometimes.

Each parenthesis in the project path throws errors

Some examples:

C:\Projects(6.0)\test.ps1
C:\Projects(\test.ps1
C:\Projects(a\test.ps1
C:\Projects()\test.ps1
C:\Projects)\test.ps1

Run-in-powershell does not work with paths like these.

Errors:
C:\PSProjects\Sample(a\test.ps1

ParserError:
Line |
   1 |  cd c:\PSProjects\Sample(a ; & c:\PSProjects\Sample(a\test.ps1
     |                           ~
     | Missing closing ')' in expression.

C:\PSProjects\Sample (6.0)\test.ps1

Set-Location: A positional parameter cannot be found that accepts argument '6'.
&: The term 'c:\PSProjects\Sample ' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

May you fix this? Please?

Error when trying to run Powershell code in external window when ampersand is in filepath

Error Message:

  • "The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
  • + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    
  • + FullyQualifiedErrorId : AmpersandNotAllowed"
    

The cause is apparently because the file path has an ampersand in it. I don't think it used to do this but do not know for certain as most of the scripts in this location were written before I started using VSCode (I am still a newish user and not very familiar with how to manipulate VSCode very well so forgive me if there is an easy setting workaround to this.).

  • e.g. "C:\Users\myusername\OneDrive...\Ref**&**Logs\PS_open\Force Map.ps1"

If I run the script manually using & and the file path it runs within vscode fine. It is just harder for me to troubleshoot this way.
e.g. This works:

  • & "C:\Users\myusername\OneDrive...\Ref**&**Logs\PS_open\Force Map.ps1"

I saw a similar post that was for python but that it was fixed back in 2018 and I don't think it was using this extension. I couldn't figure out how to apply this to this Run in Powershell extension.

Thanks, Lawrence

Version: 1.91.1 (user setup)
Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729
Date: 2024-07-09T22:06:49.809Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.19045

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.