Published on

Resolve the Conflict Between VS Code `code` Command and Cursor `cursor` Command In Windows 11

Authors

Cursor is a recently popular AI editor. Before this, I was using the VS Code editor. However, after I downloaded Cursor, I encountered a conflict between the code command in VS Code and Cursor as the following:

When I use code . command in PowerShell, the editor that opens is Cursor instead of VS Code.

image-20241217231522259

How to fix it:

  • Find code and cursor command files

PowerShell (replace Username with your Username ):

 Get-Command code
  • Backup code.cmd and code
 Copy-Item "C:\Users\Username\AppData\Local\Programs\cursor\resources\app\bin\code.cmd" "C:\Users\<Username>\AppData\Local\Programs\cursor\resources\app\bin\code.cmd.bak"

  Copy-Item "C:\Users\Username\AppData\Local\Programs\cursor\resources\app\bin\code" "C:\Users\<Username>\AppData\Local\Programs\cursor\resources\app\bin\code.bak"
  • Delete code.cmd and code
Remove-Item "C:\Users\Username\AppData\Local\Programs\cursor\resources\app\bin\code.cmd"
Remove-Item "C:\Users\Username\AppData\Local\Programs\cursor\resources\app\bin\code"

image-20241217233028918

  • And then we can use code to open VS Code