How to? run a BTM in elevated, inv tcc tab window

#1
I have a BTM that copies an INI file to %ProgramFiles% and as such I need to run this BTM in an elevated TCC tab, _only_ if the current session is not elevated. How would I do this please?

start /elevated /inv /tab <path to tcc> /c <path to btm>

???
 
#5
Code:
iff %_elevated eq 1 then
  call C:\TCMD\UpdateWinapp2.btm
else
  rem start an elevated TCC invisable to do the copying - mentioned in the iff statement above....
  start /elevated /inv /pgm "%_CMDSPEC" /C "C:\TCMD\UpdateWinapp2.btm"
endiff
should work then?

and C:\TCMD\UpdateWinapp2.btm is:

Code:
  echo.
  copy /md "https://raw.githubusercontent.com/MoscaDotTo/Winapp2/master/Winapp2.ini" C:\TCMD\WinApp2_Ini\
  echo.
  rem convet UNIX to ASCII
  TPIPE /input=C:\TCMD\WinApp2_Ini\Winapp2.ini /eol=0,2,0 /output=C:\TCMD\WinApp2_Ini\Winapp2.MSD
  echo.
  rem copy new winapp2.ini + C:\Users\Galloway\Desktop\Charles Desktop\Annie\custom.ini to %ProgramFiles%\CCleaner\winapp2.ini
  copy "C:\TCMD\WinApp2_Ini\Winapp2.MSD" + "%UserProfile%\Desktop\Charles Desktop\Annie\custom.ini" "%ProgramFiles%\CCleaner\Winapp2.ini"
  echo.
 
#6
copy "C:\TCMD\WinApp2_Ini\Winapp2.MSD" + "%UserProfile%\Desktop\Charles Desktop\Annie\custom.ini" "%ProgramFiles%\CCleaner\Winapp2.ini"
When you start a program elevated, %UserProfile% will be the userprofile of admin account, instead of your regular user account.
SET u in the elevated TCC gives me:
Code:
[C:\Temp\ff]set u
USERDOMAIN=FF
USERNAME=Admin
USERPROFILE=C:\Users\Admin
You could use the full path (C:\....) or place the file(s) outside the userprofiel.
 
#7
When you start a program elevated, %UserProfile% will be the userprofile of admin account, instead of your regular user account.
SET u in the elevated TCC gives me:
Code:
[C:\Temp\ff]set u
USERDOMAIN=FF
USERNAME=Admin
USERPROFILE=C:\Users\Admin
You could use the full path (C:\....) or place the file(s) outside the userprofiel.
It works fine as coded....
 
#8
When you start a program elevated, %UserProfile% will be the userprofile of admin account, instead of your regular user account.
SET u in the elevated TCC gives me:
Code:
[C:\Temp\ff]set u
USERDOMAIN=FF
USERNAME=Admin
USERPROFILE=C:\Users\Admin
You could use the full path (C:\....) or place the file(s) outside the userprofiel.
It works fine as coded....
 
#9
Charles is correct; you cannot run an elevated tab in a non-elevated TCMD.
What will work (to my surprise, actually) is running as another user in a new tab:
Code:
set password=12345
start "Admin Tab" /TAB /runas admin %password% /pgm tcc.exe
Didn't try to make it hidden, btw.

(Now I have to run to change my password, before I get hacked by forum members ;-)