Windows build number: 18363.418
Windows Terminal version (if applicable): 0.5.2762.0
WinTerm should run as administrator
There is an error and a box appears with:
[Window Title]
C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\wt.exe
[Content]
C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\wt.exe
The file cannot be accessed by the system.
[OK]
Comment: Running as admin from the Windows Terminal (Preview) shrortcut icon in the start menu works fine.
This is an OS bug that we're pursuing internally. Thanks for reporting!
@DHowett-MSFT is there any bug tracking system where we can watch/subscribe for updates on this issue?
@Serhiy-Shekhovtsov just this one. Sorry!
Sorry to bug, but I just wanted to check, could we not provide a secondary launcher exe that can be launched in Admin and launches wt.exe for us? The most simple version of this seems to work with Admin just fine.
This should probably only really be considered if the external issue is going to take a long time to resolve, but it's a decent workaround in the meantime. (And even if Windows Terminal doesn't provide it, others might want to know you can do it.)
Unfortunately, unless we ship it as a sidecar (like, an executable that you have to download and install separately), it's going to be subject to the same issues as wt.exe itself. Things that live in appx/msix packages are simply _troublesome_ in this regard.
I see, thanks!
in the interim, use a 3rd party launcher, e.g. nircmd
nircmd.exe elevate "shell:appsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App"
confirm metro app path via powershell:
Get-appxpackage *WindowsTerminal*
so you can make a shortcut
Source of elevate see: https://stackoverflow.com/a/12264592/1016343
::::::::::::::::::::::::::::::::::::::::::::
:: Elevate.cmd - Version 4
:: Automatically check & get admin rights
:: see "https://stackoverflow.com/a/12264592/1016343" for description
::::::::::::::::::::::::::::::::::::::::::::
@echo off
CLS
ECHO.
ECHO =============================
ECHO Running Admin shell
ECHO =============================
:init
setlocal DisableDelayedExpansion
set cmdInvoke=1
set winSysFolder=System32
set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
setlocal EnableDelayedExpansion
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
ECHO.
ECHO **************************************
ECHO Invoking UAC for Privilege Escalation
ECHO **************************************
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
ECHO args = "ELEV " >> "%vbsGetPrivileges%"
ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
ECHO Next >> "%vbsGetPrivileges%"
if '%cmdInvoke%'=='1' goto InvokeCmd
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
goto ExecElevation
:InvokeCmd
ECHO args = "/c """ + "!batchPath!" + """ " + args >> "%vbsGetPrivileges%"
ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas", 1 >> "%vbsGetPrivileges%"
:ExecElevation
"%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %*
exit /B
:gotPrivileges
setlocal & cd /d %~dp0
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
::::::::::::::::::::::::::::
::START
::::::::::::::::::::::::::::
REM Run shell as admin (example) - put here code as you like
start D:\bat\windows_terminal\windows_terminal.bat
exit
plus
start C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\wt.exe
exit
Change username
If anyone is still looking for a simpler work-around, here is one.
You can create a shortcut with location pointing to the following command.
C:\Windows\System32\cmd.exe /c start /b %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\wt.exe for the locationThis shortcut will now open WT in admin mode. You can use this shortcut file from non-privileged cmd/wsl also to open a new Terminal window in admin mode.