One-click solution to set VSCode as the default application for development files.
Now, you can also set Cursor as the default application for development files.
- π Automatically detect all file types supported by VSCode
- π― Set VSCode as default app with one click
- π Support common programming languages and config files
- π Display setting results statistics
- β‘οΈ Fast and efficient batch processing
Including but not limited to:
-
π» Programming Languages
- Python (.py)
- JavaScript/TypeScript (.js, .ts)
- HTML/CSS (.html, .css)
- Java (.java)
- C/C++ (.c, .cpp)
- Go (.go)
- Rust (.rs)
-
π Configuration Files
- JSON (.json)
- YAML (.yml, .yaml)
- XML (.xml)
- INI (.ini)
- Config (.conf)
-
π Text Files
- Plain Text (.txt)
- Markdown (.md)
- Log Files (.log)
- macOS system
- VSCode installed
- duti installed
- Windows 10/11
- VSCode or Cursor installed
- PowerShell 5.0+
- Administrator privileges
Install duti (if not already installed):
brew install duti
It is not necessary.
Simply run the script:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/luoling8192/defaults-to-vscode/HEAD/set_vscode_defaults.sh)"
Simply run the script:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/luoling8192/defaults-to-vscode/HEAD/set_cursor_defaults.sh)"
-
Download the script file
- For VSCode: Download
set_vscode_defaults_win.ps1
- For Cursor: Download
set_cursor_defaults_win.ps1
- For VSCode: Download
-
Run PowerShell as Administrator
- Right-click PowerShell
- Select "Run as Administrator"
-
Navigate to script directory
cd "path\to\script\folder"
- Set execution policy and run script
# Allow script execution
Set-ExecutionPolicy Bypass -Scope Process -Force
# Run VSCode script
.\set_vscode_defaults_win.ps1
# Or run Cursor script
.\set_cursor_defaults_win.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/luoling8192/defaults-to-vscode/main/set_vscode_defaults_win.ps1'))
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/luoling8192/defaults-to-vscode/main/set_cursor_defaults_win.ps1'))
Setting VSCode as default application for all supported file types...
Setting default application for UTI: public.plain-text
β Success: public.plain-text
Setting default application for UTI: public.python-script
β Success: public.python-script
...
Operation completed!
Successfully set: 42
Failed: 3
- If you get permission errors, try running with sudo
- Make sure VSCode is installed in the default location
- Check if duti is properly installed
-
Execution Policy Error
Set-ExecutionPolicy Bypass -Scope Process -Force
-
Application Not Found
- Ensure VSCode/Cursor is properly installed
- VSCode default installation paths:
-
Insufficient Permissions
- Ensure PowerShell is run as Administrator
- Check user account permissions
-
Download Failure
- Check network connection
- Try local installation method
- Script creates backups in
registry_backups
folder - Double-click backup file to restore
- Or manually set in Control Panel
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- duti for providing the command-line tool
- The VSCode team for the amazing editor
Some file associations might fail due to system restrictions or invalid UTIs. This is normal behavior and won't affect the overall functionality.
If you have any questions or suggestions, please open an issue in the repository.
Made with β€οΈ for developers who love VSCode