How to? Launching TCC -- avoiding UAC dialog

Dec 7, 2009
238
2
Left Coast, USA
I don't want to shut off UAC on this Win 7 machine entirely -- but I'm tempted even though it's not a very good idea.

I'm an admin on the box, but I always always get the do-you-want-to-run-this-program query if I attempt to run TCC "elevated."

Is there some way to launch TCC "elevated" and without that dialog appearing?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,495
91
Albuquerque, NM
prospero.unm.edu
  • Like
Reactions: mikea
May 20, 2008
11,538
103
Syracuse, NY, USA
Yes, it is possible to do this. Sorry, I don't have time to write up detailed instructions just now, but here's a relevant web site:

http://www.techrepublic.com/blog/wi...c-restricted-programs-without-the-uac-prompt/

Executive summary: Create a Task Scheduler job which runs TCC as admin, then create a desktop shortcut which starts that job.
The task:

General: give it a name (e.g., "TCC"); check "Run with highest privileges"
Triggers: none
Actions: start a program (e.g., "g:\tc15\tcc.exe /q")
Conditions: none
Settings: check "Allow task to be run on demand"​

The shortcut: use the name you gave to the task.

c:\windows\system32\schtasks.exe /run /tn TCC​

This causes a brief but unsightly extra console for schtasks.exe. I got around that by using a copy of schtasks.exe which had been changed from a console app to a windows app with Microsoft's EDITBIN.EXE (which comes with VC and, I suppose, other development products)
 
  • Like
Reactions: mikea
Dec 7, 2009
238
2
Left Coast, USA
Right Click on the Take Command shortcut, and select Properties.
Click Advanced.
Put a check mark in "Run as administrator".
Click Ok to dismiss the Advanced Options dialog, then click Ok to dismiss the Take Command Properties dialog.
Had that part covered. The issue is ensuring that the UAC confirmation doesn't appear every time.
 
Dec 7, 2009
238
2
Left Coast, USA
Thanks kindly to Charles and Vince w.r.t. the task-scheduler solution. In all the times I've used that app I never knew about this way of using it. The brief/unsightly appearance of a console window is only barely noticeable. The only drawback I see is that for some reason, when the TCC window has opened, Windows sends the focus somewhere else. I have to click the TCC window to get the focus back. Not a big deal or a deal-breaker. For all I know, there's some window-related command internal to TCC that will change the focus and if so I could maybe put it into the TCSTART script. I'll hunt around in the online help for that.

Thanks again.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
I don't want to shut off UAC on this Win 7 machine entirely -- but I'm tempted even though it's not a very good idea.

I'm an admin on the box, but I always always get the do-you-want-to-run-this-program query if I attempt to run TCC "elevated."

Is there some way to launch TCC "elevated" and without that dialog appearing?

Just change your name to Bill Gates...

[On the focus question]
Check the ACTIVATE and WINDOW commands.
 
Dec 7, 2009
238
2
Left Coast, USA
> change your name to Bill Gates...

Huh. I'll look into that.

Ok...tried putting

if %_elevated == 1 activate "%_wintitle" TOP

at the very end of TCSTART. That didn't work. Tried TOPMOST instead (which isn't desirable, but let's see if it works...nope, didn't work). With the WINDOW command, per the online help TOP and TOPMOST are used only in tab windows — presumably that means within TCMD — and I'm just running TCC by itself. Hmm. Maybe the Task Scheduler itself has some option pertaining to this.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,495
91
Albuquerque, NM
prospero.unm.edu
Ok...tried putting

if %_elevated == 1 activate "%_wintitle" TOP

at the very end of TCSTART. That didn't work. Tried TOPMOST instead (which isn't desirable, but let's see if it works...nope, didn't work). With the WINDOW command, per the online help TOP and TOPMOST are used only in tab windows — presumably that means within TCMD — and I'm just running TCC by itself. Hmm. Maybe the Task Scheduler itself has some option pertaining to this.

I suspect that this would be pretty easy to add as a plugin command. 4CONSOLE seems like the obvious plugin for it.... Vince?
 
May 20, 2008
11,538
103
Syracuse, NY, USA
Thanks kindly to Charles and Vince w.r.t. the task-scheduler solution. In all the times I've used that app I never knew about this way of using it. The brief/unsightly appearance of a console window is only barely noticeable. The only drawback I see is that for some reason, when the TCC window has opened, Windows sends the focus somewhere else. I have to click the TCC window to get the focus back. Not a big deal or a deal-breaker. For all I know, there's some window-related command internal to TCC that will change the focus and if so I could maybe put it into the TCSTART script. I'll hunt around in the online help for that.

Thanks again.
I forgot about that focus thing. I took care of it like this.
Code:
IFF %_ELEVATED == 1 THEN
    CLICK /L %@EVAL[80 + %@WORD[1,%@WINPOS[%_WINTITLE]]] %@EVAL[20 + %@WORD[0,%@WINPOS[%_WINTITLE]]]
ENDIFF
CLICK is in my SYSUTILS plugin. A quick test shows that this also works.
Code:
    DELAY /M 100
    ACTIVATE "%_WINTITLE"
 
May 20, 2008
11,538
103
Syracuse, NY, USA
I suspect that this would be pretty easy to add as a plugin command. 4CONSOLE seems like the obvious plugin for it.... Vince?
[See my recent post.] It's a little odd that CLICK works without a delay while ACTIVATE requires a delay.
Anyway, what did you have in mind, Charles?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,495
91
Albuquerque, NM
prospero.unm.edu
[See my recent post.] It's a little odd that CLICK works without a delay while ACTIVATE requires a delay.
Anyway, what did you have in mind, Charles?

I was thinking of a command to set the focus to the current TCC window, or maybe to a window specified on the command line. (But "the current TCC window" is itself a pretty slippery concept: it might mean the console window, or the Take Command main window... or the Console2 window, or the ConEmu window....)
 
Dec 7, 2009
238
2
Left Coast, USA
Regarding:
Code:
DELAY /M 100
ACTIVATE "%_WINTITLE"

Without the delay + activate command: the console window opens. Its border is a color that means: it doesn't have the focus. The cursor is not blinking at the command line. The task's icon in the taskbar is blinking, indicating "need attention."

With the activate command: the console window opens. Its border is again a color that means it doesn't have the focus. The task's item in the taskbar is again blinking ("need attention"). This time the cursor does appear at the command prompt and is blinking. But I still have to click the TCC window to bring the focus back (or, I can cycle to it via the task switcher).

Ah, the WWW (wacky world of Windows). :-|
 
May 20, 2008
11,538
103
Syracuse, NY, USA
Regarding:
Code:
DELAY /M 100
ACTIVATE "%_WINTITLE"

Without the delay + activate command: the console window opens. Its border is a color that means: it doesn't have the focus. The cursor is not blinking at the command line. The task's icon in the taskbar is blinking, indicating "need attention."

With the activate command: the console window opens. Its border is again a color that means it doesn't have the focus. The task's item in the taskbar is again blinking ("need attention"). This time the cursor does appear at the command prompt and is blinking. But I still have to click the TCC window to bring the focus back (or, I can cycle to it via the task switcher).

Ah, the WWW (wacky world of Windows). :-|
I have never been annoyed by something stealing focus and I have always been annoyed by the Windows foreground lock feature.

I tried to reproduce your focus failure problem and couldn't. Quite possibly this is because I had applied a common tweak.

In "HKEY_CURRENT_USER\Control Panel\Desktop", set "ForegroundLockTimeout" to (REG_DWORD) 0.

According to TechNet, ForegroundLockTimeout "specifies the time [in milliseconds], following user input, during which the system keeps applications from moving into the foreground".

I suspect changing this value requires at least a logout/login.
 
Last edited:
Dec 7, 2009
238
2
Left Coast, USA
I have never been annoyed by something stealing focus and I have always been annoyed by the Windows foreground lock feature.

I tried to reproduce your focus failure problem and couldn't. Quite possibly this is because I had applied a common tweak.

In "HKEY_CURRENT_USER\Control Panel\Desktop", set "ForegroundLockTimeout" to (REG_DWORD) 0.

According to TechNet, ForegroundLockTimeout "specifies the time [in milliseconds], following user input, during which the system keeps applications from moving into the foreground".

I suspect changing this value requires at least a logout/login.

Can give that a try. On this system at the moment the value data is decimal 200000 (hex 30d40). So...change decimal value simply to 0?
 
Similar threads
Thread starter Title Forum Replies Date
mikea How to? TCC 15: popup windows; launching Perl scripts Support 10
Joe Caverly Help not launching in CMDebug v23.00.14 x64 Support 1
gentzel Bug launching external commands in 20.11.43 Support 11
R Everything /o not launching Preferences dialogue Support 5
Phileosophos TakeCommand exits after launching TortoiseHg Workbench Support 4
jwiede ide.exe not launching? Support 13
Jay Sage Problem Launching Google Earth from TCMD Support 17
noahcoad Possible Bug? Launching 4nt.exe Goes Hairwire Support 10
A Can you set an image file 'tag' with TCC/4NT? Support 2
P PSHELL not working in TCC 26 Support 9
vefatica SCRIPT makes TCC disappear. Support 16
MickeyF TCC suddenly crashing (not TCC's fault) Support 2
Z CMDDebug - TCC unknown command Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 28.02.17 Support 0
vefatica TCC startup: /IP not honored after /K Support 1
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
C COMSPEC constantly reset to TCC.EXE Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
C How to? starting TCC/TCMD v25 Support 2
CWBillow TCC and TCMD in Powershell Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.24 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.23 uploaded Support 0
Alpengreis Fixed Crash after copy dialog with big TCC.exception.log Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT v27.01 Build 22 Uploaded Support 0
L FTYPE in TCC, less quirky than in cmd.exe Support 3
V Set path permanently from within TCC? Support 3
DrusTheAxe Runaway TCC.exception.log filling drive Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.21 uploaded Support 0
Joe Caverly tcc.exception.log Support 3
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.20 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.19 Support 0
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
vefatica SCRIPT ... TCC disappears Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT v27.0.18 Support 0
Jesse Heines Access Denied errors in TCC 27 Support 9
fpefpe How to? tcc inifile (%_ininame) Support 3
M How to? Black TCC Prompt Support 2
D Differences between TCC and CMD with COPY /b Support 4
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
Jay Sage Extra TCC Tasks Support 6
vefatica Can I turn off the minimize to tray mechanism in TCC? Support 5
N Command execution slows down in TCC Prompt after a while Support 6
R Upgrade TCMD 19 to TCC 26 Support 1
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
samintz How to? Is this doable in TCC? Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 26.02.41 Uploaded Support 0
D TCC tab detaching & restarting Support 3
Ó Recent git output not shown on TCC Support 1
P Kill all other instances of tcc from a btm batch file Support 2
L Using TCC.exe through an SSH connection Support 3

Similar threads