Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Windows Administrator shell command execution

63 views
Skip to first unread message

Harald Oehlmann

unread,
Feb 28, 2023, 8:42:54 AM2/28/23
to
On a stand-alone Windows 10 System, I want to set the system clock.

This aparently requires administrator privileges.

https://www.wikihow.com/Change-the-Computer-Time-and-Date-Using-the-Command-Prompt

The command "date" and "time" should be executed.

Is there any experience, how to do that from a TCL program?
The administrator prompt would be ok for me.

Thus, create a batch file with parameters and give them administrator
properties.
Then execute them with exec...

I will try.

Thanks for any idea,
Harald

Arjen Markus

unread,
Feb 28, 2023, 8:50:56 AM2/28/23
to
Could this be done via TWAPI?

Regards,

Arjen

Harald Oehlmann

unread,
Mar 1, 2023, 3:33:22 AM3/1/23
to
Thanks, Arjen, for the response.
I want to state, that the issue is not to hot at the moment.
I may care in a month or so.

Thank you all,
Harald

Ralf Fassel

unread,
Mar 1, 2023, 5:09:10 AM3/1/23
to
* Harald Oehlmann <wort...@yahoo.com>
| Am 28.02.2023 um 14:50 schrieb Arjen Markus:
| > On Tuesday, February 28, 2023 at 2:42:54 PM UTC+1, Harald Oehlmann wrote:
| >> On a stand-alone Windows 10 System, I want to set the system clock.
| >>
| >> This aparently requires administrator privileges.
| >>
| >> https://www.wikihow.com/Change-the-Computer-Time-and-Date-Using-the-Command-Prompt
| >>
| >> The command "date" and "time" should be executed.
| >>
| >> Is there any experience, how to do that from a TCL program?
| >> The administrator prompt would be ok for me.
--<snip-snip>--
| > Could this be done via TWAPI?
| > Regards,
| > Arjen
>
| Thanks, Arjen, for the response.
| I want to state, that the issue is not to hot at the moment.
| I may care in a month or so.

https://twapi.magicsplat.com/v4.7/security.html

may come handy here.

R'

Ashok

unread,
Mar 1, 2023, 6:21:02 AM3/1/23
to
twapi::shell_execute -verb runas -path cmd.exe -params {/c time 04:49 pm}

Note user will get the elevation prompt.

/Ashok

et99

unread,
Mar 1, 2023, 11:04:09 AM3/1/23
to
To run a program as administator on windows 10 w/o
needing to respond to the UAC prompt, one can create a
task scheduler entry.

https://windowsloop.com/how-to-run-a-program-as-administrator-without-prompt/

Only about 25 steps, but hey, this is windows :)

I use this technique to launch a tcl/twapi program to
run an easeus todo incremental image backup with 1
click whenever I get nervous about un-backed up work.

Harald Oehlmann

unread,
Mar 3, 2023, 3:51:01 AM3/3/23
to
Dear Ashok,
that just works great, thank you !

Here is the extended solution to set time and date together:

twapi::shell_execute -verb runas -path cmd.exe -params {/c "time 09:46 &
date 3.3.2023" }

My appreciations to the encoding work !

Thanks again,
Harald

Harald Oehlmann

unread,
Mar 3, 2023, 4:03:45 AM3/3/23
to
Added this use-case to general discussion of:
https://wiki.tcl-lang.org/page/TWAPI

Thank you all,
Harald
0 new messages