Linked Questions

3 votes
0 answers
2k views

I'm trying to create a powershell alias for my ng build command which is fairly long. node --max_old_space_size=4096 .\node_modules\@angular\cli\bin\ng build --configuration=debug --watch Aliasing the ...
Chris S.'s user avatar
1 vote
0 answers
2k views

I have a python program that creates a numbered list up to the value i enter I have tried using new-alias numberlist "python C:\path\to\file\numberlist.py" to do this but it returns the ...
Mathias's user avatar
  • 103
410 votes
22 answers
482k views

Out-File seems to force the BOM when using UTF-8: $MyFile = Get-Content $MyPath $MyFile | Out-File -Encoding "UTF8" $MyPath How can I write a file in UTF-8 with no BOM using PowerShell? ...
sourcenouveau's user avatar
55 votes
10 answers
46k views

I've written function 'A' that will call one of a number of other functions. To save re-writing function 'A', I'd like to pass the function to be called as a parameter of function 'A'. For example: ...
woter324's user avatar
  • 3,250
17 votes
1 answer
14k views

I am a novice with PowerShell. In Msys2 (or Lnux), I have defined a function npp npp () { ${NPP_PATH} "$@" } such that if I call from the command prompt npp it launches Notepad++ (as ...
sancho.s ReinstateMonicaCellio's user avatar
17 votes
1 answer
68k views

Is there a PowerShell equivalent to the ls -al command in Linux/Unix? I tried to find something, but it said there wasn't an equivalent command in PowerShell.
butlertj10's user avatar
9 votes
3 answers
2k views

Command that output the result in string instead of objects: ls | Out-String -Stream Output: Directory: C:\MyPath\dir1 Mode LastWriteTime Length Name ---- ...
iotop's user avatar
  • 105
4 votes
2 answers
3k views

I am writing a script and I want to pass the values but also see them displayed Get-Content data.txt | Tee-Object | data_processor.exe But Tee-Object always requests a file and I just want to see it ...
Sled's user avatar
  • 19.2k
7 votes
1 answer
4k views

Im setting up my powershell profile to create aliases of commonly used commands. On Microsoft's documentation it says, if I want to make an alias for a command with parameters, I should make the value ...
nreh's user avatar
  • 526
5 votes
3 answers
2k views

I'm writing a script that will perform some git actions and I want to use Start-Transcript to monitor it. The transcript is however missing most of the git output. I've tried to pipe the git output ...
Zam's user avatar
  • 1,426
-4 votes
1 answer
6k views

I am a newcomer to PS scripting. I have found that, generally speaking, PS adds a lot of newlines to output of its commands. I am giving below a couple of examples of what I found somewhat generalized ...
sancho.s ReinstateMonicaCellio's user avatar
5 votes
2 answers
2k views

Consider the following simple function: function Write-HostIfNotVerbose() { if ($VerbosePreference -eq 'SilentlyContinue') { Write-Host @args } } And it works fine: Now I want to ...
mark's user avatar
  • 63.6k
2 votes
1 answer
2k views

I'm using the below code to display the results of PowerShell Jobs with a timeout of 120 seconds. I would like to enhance this code by incorporating Write-Progress (based on number of jobs completed)....
MKANET's user avatar
  • 683
2 votes
1 answer
2k views

I was wondering if there's any simple way to make aliases for powershell like cmd. For example: In cmd, doskey art=php artisan $* where $* is optional. Currently, I'm using the following alias in ...
JawadR1's user avatar
  • 399
1 vote
1 answer
1k views

I'm writing a function that wraps a cmdlet using ValueFromRemainingArguments (as discussed here). The following simple code demonstrates the problem: works function Test-WrapperArgs { Set-...
Thorsten's user avatar
  • 326
3 votes
2 answers
983 views

How can I do a alias in powershell to start notepad++ have Start notepad++ and have alias i wanna combinate that set-alias -name notepad -value start notepad++ but i get this error Set-Alias : A ...
Tibor's user avatar
  • 37
2 votes
3 answers
996 views

I would like to call external commands from PowerShell Core such as Git, Python or other proprietary executables, but I want the call to throw when the exit code is non-zero while respecting ...
boernsen's user avatar
  • 121
3 votes
2 answers
1k views

Problem When a Hashtable is used as input for Should, Pester outputs only the typename instead of the content: Describe 'test' { It 'test case' { $ht = @{ foo = 21; bar = 42 } $ht |...
zett42's user avatar
  • 28.3k
4 votes
1 answer
493 views

I'm trying to create a wrapper (proxy) for Pester's Should cmdlet. Possible use cases include transparent logging of test input even in case of success and improve the way Pester logs objects of ...
zett42's user avatar
  • 28.3k
2 votes
1 answer
590 views

How do I forward all pipeline input and arguments to a command inside an alias function. For example if I wanted to alias tail function tail { coreutils tail @args } works fine with tail -n 5 test....
Sylent Tech's user avatar
2 votes
2 answers
675 views

I am trying to make PowerShell automatically prepend a timestamp to every line subsequent to invoking my custom ShowTimeStamps function. The function attempts to redirect output thru a filter that ...
Gary's user avatar
  • 31
4 votes
1 answer
440 views

In a pipeline like GenerateLotsOfText | external-program | ConsumeExternalProgramOutput when external-program exits, the pipeline just keeps on running until GenerateLotsOfText completes. Suppose ...
stijn's user avatar
  • 36.1k
2 votes
1 answer
435 views

Both python and powershell support a form of splatting array and named arguments as function inputs, a very useful feature. However powershell seem to be internally inconsistent somewhat. I am trying ...
Yorai Levi's user avatar
0 votes
1 answer
256 views

I am trying to set up an alias in Powershell. For some weird reason, they do not support spaces (arguments), so I have to create a function instead I ran this command: function glo { git log --oneline ...
Riikka's user avatar
  • 9
1 vote
1 answer
198 views

Exploring the difference between help and get-help I did: cd Function: get-content help all the input-parameter are defined like: [string]${Name} $=initiate a variable, {} a hashtable?? Thanks ...
Purclot's user avatar
  • 583
1 vote
2 answers
100 views

I want to extend the functionality of cd but retain all of the existing parameters of Set-Location. So I created a function go which does a bunch of additional stuff and then aliased cd to it (I had ...
YorSubs's user avatar
  • 4,248
1 vote
1 answer
94 views

A little colorblindness problem: [ConsoleColor]::DarkRed (and also Red) is like nearly invisible for me. I have to select the text in order to be able to read it. I've been configuring some stuff in ...
Laoujin's user avatar
  • 10.3k