mklement0 / native Goto Github PK
View Code? Open in Web Editor NEWPowerShell module for native-shell and external-executable calls.
License: MIT License
PowerShell module for native-shell and external-executable calls.
License: MIT License
Is it possible to make PowerShell always call ie
when calling external programs?
Similar to using #!/usr/bin/env bash
or #!/usr/bin/env sh
, maybe something like
# Note: By default, due to its ubiquity, we use bash, unless -UseSh was passed or bash doesn't exist (unlikely).
if ($UseSh) {
(Get-Command -CommandType 'Application' -Name 'sh').Path
} else {
@(Get-Command -CommandType 'Application' -Name 'bash', 'sh' -ErrorAction SilentlyContinue)[0].Path
}
PING A,B
IE PING A,B
Ping request could not find host A,B.
Ping request could not find host A.
I use Scoop to install command line programs on Windows. For each executable, Scoop creates two shims in ~/scoop/shims/
: a .ps1
and an .exe
. For example:
PS C:\> Get-Command -All git
CommandType Name Version Source
----------- ---- ------- ------
ExternalScript git.ps1 C:\Users\imgx64\scoop\shims\git.ps1
Application git.exe 0.0.0.0 C:\Users\imgx64\scoop\shims\git.exe
If you try to run such shim with ie
, it fails because the .ps1
has higher priority.
PS C:\> ie git --version
This command supports external executables (applications) only; "git" ("git.ps1") is a command of type ExternalScript
At C:\Users\imgx64\Documents\WindowsPowerShell\Modules\Native\1.0.3\Native.psm1:540 char:5
+ Throw (
+ ~~~~~~~
+ CategoryInfo : InvalidArgument: (git:String) [], ArgumentException
+ FullyQualifiedErrorId : InvalidCommandType
Is it possible to detect this and run the .exe
instead, without the user having to type .exe
explicitly?
PS C:\> ie git.exe --version
git version 2.28.0.windows.1
cmd.exe
does have a simpler mode for passing in command-line stuff: use /s
and put a pair of double quotes over whatever is in /c
as the end of the cmdline. The quote would be simply stripped and the contents used.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.