Skip to content

Instantly share code, notes, and snippets.

View devnicg's full-sized avatar
🎯
Focusing

Nicola Goderis devnicg

🎯
Focusing
View GitHub Profile
@devnicg
devnicg / run.ps1
Created July 12, 2024 14:47
Only call functions when script is explicility invoked
# Stop execution if script is not explicitely invoked
if ($MyInvocation.InvocationName -ne $PSCommandPath){
return
}
# Execute only if script is explicitely invoked
if ($MyInvocation.InvocationName -eq $PSCommandPath){
Write-Output "Script was called by powershell.exe"
}