Filter
Exclude
Time range
-
Near
Replying to @jamonholmgren
yeah you make your own lib.sh and then a header you put in every file that looks like shebang usr bin env bash script_root = garbage to get PSScriptRoot in bash . "${script_root}/path_to/lib.sh setup shellcheck with all rules, only ignore rules per file/file

1
2
129
4 Sep 2023
A little known feature of the #PowerShell switch statement is that it can process a file with the `-File` parameter and the `-Regex` parameter. That is pretty fast to read and compare a 10K line text file. @BrucePayette mentioned this when he was on my meetup talking about his new Braid language (sits on top of .NET and PS) and Pattern Matching. ---- $fileName = "$PSScriptRoot\random_text_10k.txt" $countMap = [ordered]@{a = 0; b = 0; c = 0; d = 0; e = 0 } $timing = Measure-Command { switch -Regex -File $fileName { '^a' { $countMap.a } '^b' { $countMap.b } '^c' { $countMap.c } '^d' { $countMap.d } '^e' { $countMap.e } } } "Took {0} seconds to read a 10k line file and match" -f $timing.TotalSeconds $countMap ---- Result ---- Took 0.0584586 seconds to read a 10k line file and match Name Value ---- ----- a 1944 b 2022 c 1993 d 2033 e 2008
3
15
54
10,550
9 Oct 2022
$PSScriptRootを使って絶対パス化する? それしかないか。
2
15 Jul 2022
Running $PSScriptRoot in Selected Code - Power Tips - Power Tips - IDERA Community community.idera.com/database…

3
PowerShell v3 以降は cd $PSScriptRoot でも行けます
2
Replying to @Sheeeeepla
ピングーから来ました。 powershell 3 から $PSScriptRoot が使えますよ。 vwnet.jp/Windows/PowerShell/…

1
1
3
$psscriptroot is split-path -parent $myinvocation.mycommand.definition for the lazy. And I’m ok with it.
1
1
6 Jul 2020
あ。更に嘘ついた。そんなことなかった。$PSScriptRootで行ける(失敬
2
Replying to @xenappblog
Could I suggest using $psscriptroot and the path to the file instead of all the directory changing?
1
2
New home @ github.com/IISResetMe/PSProf… Apart from the module name change, Measure-Script now supports: - Scripts w/ v4/v5 language features - $PSCommandPath/$PSScriptRoot resolution in file-based scripts - Caller-scoped scriptblock execution

2
9
because cmd.exe processes .BAT files line by line (no read file lock) you can just delete yourself :-) fs0 is the path to the bat file PS is more like Remove-Item $PSScriptRoot -Force -Confirm:$JustDOIT
3
"Dot Sourcing with PSScriptRoot" zpr.io/gWGwq #PowerShell

2
7
13 Aug 2019
1
2
25 Oct 2018
When running InModuleScope, you can use $PSScriptRoot or $PSCommandPath to get path to the >test script<. And $script:PSScriptRoot or $script:PSCommandPath to get path to the tested >module<. #powershell #pester #psPester @PSPester
16
34
9 Apr 2018
Replying to @mobileck @SOZDBA
you are selecting the text and running it, which is analogous to typing it in the console, which has no psscriptroot
1
1
21 Nov 2017
Replying to @joshduffney
I usually do this `. $PSScriptRoot\Code.ps1` unless I need to be PSv2 compatible. Or did you mean something different?
1
1
19 Jul 2017
@MSH_Dave "You can't use $PSScriptRoot at the command line. That variable is only set when you're executing a ps1 or psm1 file." FACT! 👍
1