Created
September 2, 2025 01:17
-
-
Save loorlab/eee8b3434d4371143826074e6c1f3205 to your computer and use it in GitHub Desktop.
Backup VS Code - Extensions + Settings - WIN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backup-vscode.ps1 - Back up VS Code extensions and settings on Windows (ASCII-only) | |
$ErrorActionPreference = 'Stop' | |
# Paths | |
$backupPath = Join-Path $env:USERPROFILE 'Documents\VSCode_Backup' | |
$extPath = Join-Path $env:USERPROFILE '.vscode\extensions' | |
$settingsPath = Join-Path $env:APPDATA 'Code\User' | |
Write-Host ('Creando carpeta de backup en: ' + $backupPath) | |
New-Item -ItemType Directory -Force -Path $backupPath | Out-Null | |
# Back up extensions | |
if (Test-Path $extPath) { | |
Write-Host ('Respaldando extensiones desde: ' + $extPath) | |
Copy-Item -Path $extPath -Destination (Join-Path $backupPath 'extensions') -Recurse -Force | |
Write-Host 'Extensiones guardadas.' | |
} else { | |
Write-Host ('No encontre extensiones en: ' + $extPath) | |
} | |
# Back up settings | |
if (Test-Path $settingsPath) { | |
Write-Host ('Respaldando configuraciones desde: ' + $settingsPath) | |
Copy-Item -Path $settingsPath -Destination (Join-Path $backupPath 'User') -Recurse -Force | |
Write-Host 'Configuraciones guardadas.' | |
} else { | |
Write-Host ('No encontre configuraciones en: ' + $settingsPath) | |
} | |
# Export list of extensions if "code" CLI exists | |
if (Get-Command code -ErrorAction SilentlyContinue) { | |
Write-Host 'Exportando lista de extensiones...' | |
& code --list-extensions | Out-File -FilePath (Join-Path $backupPath 'extensions-list.txt') -Encoding utf8 | |
Write-Host 'Lista de extensiones exportada.' | |
} else { | |
Write-Host 'Aviso: no se encontró el comando "code" en PATH. Omitiendo exportación de lista.' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Step 1:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Step 2:
.\backup-vscode.ps1
Step 3:
C:\Users<user>\Documents\VSCode_Backup