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
28
28
Write-Information " Removing the temporary template module files since we are done using it to create the template repository files."
29
29
RemoveTemporaryModuleDirectory - tempModuleDirectoryPath $tempModuleDirectoryPath
30
30
31
+ Write-Information " Starting external process to delete this script."
32
+ DeleteThisScript
33
+
31
34
Write-Host - ForegroundColor Green " Repo initialization complete. You can now commit the changes to your repository."
32
35
}
33
36
70
73
Remove-Item - Path $tempModuleDirectoryPath - Recurse - Force - ErrorAction SilentlyContinue
71
74
}
72
75
}
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
+ }
73
92
}
You can’t perform that action at this time.
0 commit comments