summaryrefslogtreecommitdiff
path: root/setup/windows/uninst.ps1
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-12-10 13:02:08 +0800
committer魏曹先生 <1992414357@qq.com>2025-12-10 13:02:08 +0800
commit04010f6cffa34253d1883229c9f0d831b16e3367 (patch)
tree591ff3306a1ee12e78ba2e4973a71f89b58be6a3 /setup/windows/uninst.ps1
parentc740e28bd851221f32dc3f48cd94ee78352bba93 (diff)
parent15b508b7931aacd0c07ad6f52d4cefa6eef69fa1 (diff)
Merge remote-tracking branch 'origin/main'
Diffstat (limited to 'setup/windows/uninst.ps1')
-rw-r--r--setup/windows/uninst.ps139
1 files changed, 39 insertions, 0 deletions
diff --git a/setup/windows/uninst.ps1 b/setup/windows/uninst.ps1
new file mode 100644
index 0000000..d5c898d
--- /dev/null
+++ b/setup/windows/uninst.ps1
@@ -0,0 +1,39 @@
+$profileContent = Get-Content $PROFILE -ErrorAction SilentlyContinue
+if ($profileContent) {
+ $startMarker = "# JustEnoughVCS - Begin #"
+ $endMarker = "# JustEnoughVCS - End #"
+ $newContent = @()
+ $insideBlock = $false
+ $foundStart = $false
+
+ foreach ($line in $profileContent) {
+ if ($line.Trim() -eq $startMarker) {
+ $insideBlock = $true
+ $foundStart = $true
+ continue
+ }
+ if ($line.Trim() -eq $endMarker) {
+ $insideBlock = $false
+ continue
+ }
+ if (-not $insideBlock) {
+ $newContent += $line
+ }
+ }
+
+ if ($foundStart -and $insideBlock) {
+ $newContent = @()
+ $insideBlock = $false
+ foreach ($line in $profileContent) {
+ if ($line.Trim() -eq $startMarker) {
+ $insideBlock = $true
+ continue
+ }
+ if (-not $insideBlock) {
+ $newContent += $line
+ }
+ }
+ }
+
+ $newContent | Set-Content $PROFILE
+}