Detect entrypoint automatically
This commit is contained in:
parent
e63b161243
commit
8339cb3006
4 changed files with 16 additions and 2 deletions
scripts/Windows/Scripts
14
scripts/Windows/Scripts/Entrypoints.ps1
Normal file
14
scripts/Windows/Scripts/Entrypoints.ps1
Normal file
|
@ -0,0 +1,14 @@
|
|||
function Get-Entrypoint() {
|
||||
$stackTrace = Get-PSCallStack
|
||||
$call = $stackTrace[$stackTrace.Count - 1];
|
||||
|
||||
if ($null -ne $call.ScriptName) {
|
||||
return $call.ScriptName;
|
||||
} else {
|
||||
$call = $CallStack[$CallStack.Count - 2];
|
||||
return $call.ScriptName;
|
||||
}
|
||||
|
||||
|
||||
throw "No PowerShell entry point script could be found.";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue