Skip to content

Instantly share code, notes, and snippets.

@toburger
Last active January 21, 2023 10:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toburger/2360916ca87726e4a9b78efa977ed505 to your computer and use it in GitHub Desktop.
Save toburger/2360916ca87726e4a9b78efa977ed505 to your computer and use it in GitHub Desktop.
Open Excel on the same virtual Desktop

A very annoying behaviour is that Excel opens an Excel file on the virtual Desktop of an existing Excel Instance and switches to that Desktop.
If you want to avoid this behaviour you can do the following to fix it:

The fix is to call Excel with the /X parameter:

$ assoc .xlsx
.xlsx=Excel.Sheet.12

$ ftype Excel.Sheet.12
Excel.Sheet.12="C:\Program Files\Microsoft Office\Root\Office16\EXCEL.EXE" "%1"

$ ftype Excel.Sheet.12="C:\Program Files\Microsoft Office\Root\Office16\EXCEL.EXE" /X "%1"
Excel.Sheet.12="C:\Program Files\Microsoft Office\Root\Office16\EXCEL.EXE" /X "%1"

I don't use Word very often but for good measure I've checked if Word has the same annoying behaviour but it looks like the default call syntax includes already the /N parameter.

$ ftype Word.Document.12
Word.Document.12="C:\Program Files\Microsoft Office\Root\Office16\WINWORD.EXE" /n "%1" /o "%u"

Source: https://superuser.com/a/1570547/28540

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment