File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ If you have made changes to any files you may want to commit them before continu
2828 Write-Information " Removing the temporary template module files since we are done using it to create the template repository files."
2929 RemoveTemporaryModuleDirectory - tempModuleDirectoryPath $tempModuleDirectoryPath
3030
31+ Write-Information " Starting external process to delete this script."
32+ DeleteThisScript
33+
3134 Write-Host - ForegroundColor Green " Repo initialization complete. You can now commit the changes to your repository."
3235}
3336
7073 Remove-Item - Path $tempModuleDirectoryPath - Recurse - Force - ErrorAction SilentlyContinue
7174 }
7275 }
76+
77+ function DeleteThisScript
78+ {
79+ [string ] $scriptPath = $MyInvocation.MyCommand.Path
80+ [string ] $deleteCommand = " -ExecutionPolicy Bypass -NoProfile -Command `" Start-Sleep -Seconds 1; Remove-Item -Path $scriptPath -Force`" "
81+
82+ $powerShellVersion = $PSVersionTable.PSVersion.Major
83+ if ($powerShellVersion -le 5 )
84+ {
85+ Invoke-Expression - Command " powershell $deleteCommand "
86+ }
87+ else
88+ {
89+ Invoke-Expression - Command " pwsh $deleteCommand "
90+ }
91+ }
7392}
You can’t perform that action at this time.
0 commit comments