Super User Asked by Yaman on November 16, 2021
I have been using virtual desktops in Windows 10 for a while. It works fine, the only issue I found and would love to solve is as the following scenario:
In this case, it switches to Desktop 1, because it already has Excel / Word open, while I expect it to open on Desktop 2 since I am there. Of course, I could move Sheet2.xlsx / Doc2.xlsx window to Desktop 2, but I have to do it manually from multitasking.
I didn’t try other applications, but I would guess it’s the same behavior.
Is there anyway to avoid this behavior and have Windows open the other document / sheet in the current virtual desktop?
What I have observed is that when you have multiple desktops, and you choose to open a document (from any of these desktops), the OS will:
(i) if the app is not open, it will open in the current desktop.
(ii) if the app is already open, it will open the document in the last activated instance of the app (irrespective of which desktop you click it from)
So if you want to open multiple files of an app (say MS Word), before clicking open, make sure the instance of the app is activated in the current desktop.
I have seen this issue in many forums, I hope they come up with a suitable solution soon.
Answered by jpt on November 16, 2021
Since MS Office 2013, the windows of each Office app run in a single instance of the executable. When an instance opens a new window, Task View first switches to an existing app window. (My other gripe is that multiple UNDO commands backtrack chronologically across multiple windows, which is never what I want.)
I solved the problem in Office 2016 by using command line options to run each Word and Excel window in a separate instance. For Word, the option is /N
; for Excel it is /X
. It costs a little extra startup time and a little extra memory. I don't run a lot of windows at once, so for me the reduced aggravation is worth it.
For desktop icons, custom toolbars, and other shortcuts, you can simply edit the properties and add the option to the target command line:
"C:Program Files (x86)Microsoft OfficerootOffice16EXCEL.EXE" /X "C:DataWeatherWeather Log.xls"
Making the option apply when you open a file (e.g. by double-click) is a little harder.
Open a command window running as Administrator.
Find the file type associated with a file extension:
> assoc .xls .xls=Excel.Sheet.8
> ftype excel.sheet.8 excel.sheet.8="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" "%1"
> ftype excel.sheet.8="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" excel.sheet.8="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1"
You could do a wholesale change by capturing all Excel ftype definitions into a .BAT file, editing the file to add ftype
at the start of each line and /X
after each .EXE, and (for .BAT scripts) changing %1
to %%1
> ftype | find /i "office16excel" > ftypes.bat > [your text editor] ftypes.bat (make the changes described above)
Running the resulting script should produce output similar to:
> ftypes.bat > ftype dqyfile=C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE /X "%1" dqyfile=C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE /X "%1" > ftype Excel.Addin="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.Addin="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.Backup="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.Backup="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.Chart=C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE /X "%1" Excel.Chart=C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE /X "%1" > ftype Excel.Chart.8="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.Chart.8="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.CSV="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.CSV="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.Macrosheet="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.Macrosheet="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.OpenDocumentSpreadsheet.12="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.OpenDocumentSpreadsheet.12="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.Sheet.8="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.Sheet.8="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.Sheet.12="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.Sheet.12="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.SLK="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.SLK="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.Template="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.Template="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.Template.8="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.Template.8="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.Workspace="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.Workspace="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excel.XLL="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" Excel.XLL="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X "%1" > ftype Excelhtmlfile="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X Excelhtmlfile="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X > ftype Excelhtmltemplate="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X Excelhtmltemplate="C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE" /X > ftype iqyfile=C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE /X "%1" iqyfile=C:Program Files (x86)Microsoft OfficeRootOffice16EXCEL.EXE /X "%1"
Some Office apps, notably PowerPoint, have no option to start a new instance. However, running an app as a different user creates a new instance. So one workaround is to create local Windows users for as many virtual desktops as you want to open PowerPoint on concurrently. This scheme is not ideal, because you have to remember which users/instances you already have running before opening a new one. If you have only a few, it may not be too bad.
To create each user:
Settings > Accounts > Family & Other Users > [+] Add someone else to this PC
To create a shortcut which starts PowerPoint as a specified user, edit the shortcut's properties to use a command such as:
runas /user:user2 /savecred "C:Program Files (x86)Microsoft OfficerootOffice16POWERPNT.EXE"
runas
prompts for the user's password. /savecred
saves the password the first time and uses the saved password subsequently. You may want to initially make each shortcut Run: Normal window, and later change it to Run: Minimized.
These shortcuts could be either on the Windows desktop or in a custom toolbar menu. Once PowerPoint is running, you can either open a PPT file from there, or drag in a file from File Explorer. If you are working on a few PPT files for an extended time, you could create a shortcut for each file, specifying which user to run as.
Unfortunately, dragging a PPT file onto one of the desktop shortcuts described above won't work, because runas
requires that the full PowerPoint command line be quoted. Shortcuts for opening a PPT file directly need an intermediate script to sort out the quotes. Create a script such as "PowerPoint_User.bat":
:: Usage: PowerPoint_User <username> <PPT filename>
:: Opens a PPT file as a specified user, starting a new PowerPoint instance on
:: the current virtual desktop if that user was not already running PowerPoint.
:: (%~f2 expands %2 to full path with no quotes. See "call /?".)
@echo off
C:WindowsSystem32runas.exe /user:%1 /savecred "POWERPNT.EXE "%~f2""
Then create a shortcut for each user, with a command such as:
C:binPowerPoint_User.bat user2
If the shortcut is on your Windows desktop, then you can drag a PPT file onto it. If you create the shortcut in %USERPROFILE%AppDataRoamingMicrosoftWindowsSendTo
, then you can click right on a PPT file and open it from the "Send to" menu. In either case, remember that each shortcut will prompt for a password the first time it is run.
(If you need to debug the shortcut, set it to Run: Normal window, prepend cmd /k
to the command, and remove @echo off
from the script.)
Answered by George S on November 16, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP