• Windows Administrator shell command execution

    From Harald Oehlmann@21:1/5 to All on Tue Feb 28 14:42:39 2023
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arjen Markus@21:1/5 to Harald Oehlmann on Tue Feb 28 05:50:53 2023
    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.

    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
    Could this be done via TWAPI?

    Regards,

    Arjen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Wed Mar 1 09:33:17 2023
    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.

    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
    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.

    Thank you all,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Wed Mar 1 11:09:04 2023
    * Harald Oehlmann <[email protected]>
    | 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'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ashok@21:1/5 to Harald Oehlmann on Wed Mar 1 16:50:15 2023
    On 2/28/2023 7:12 PM, 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.

    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

    twapi::shell_execute -verb runas -path cmd.exe -params {/c time 04:49 pm}

    Note user will get the elevation prompt.

    /Ashok

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From et99@21:1/5 to Ashok on Wed Mar 1 08:04:06 2023
    On 3/1/2023 3:20 AM, Ashok wrote:
    On 2/28/2023 7:12 PM, 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.

    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

    twapi::shell_execute -verb runas -path cmd.exe -params {/c time 04:49 pm}

    Note user will get the elevation prompt.

    /Ashok

    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Fri Mar 3 09:47:06 2023
    Am 01.03.2023 um 12:20 schrieb Ashok:
    On 2/28/2023 7:12 PM, 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.

    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

    twapi::shell_execute -verb runas -path cmd.exe -params {/c time 04:49 pm}

    Note user will get the elevation prompt.

    /Ashok


    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Fri Mar 3 09:59:48 2023
    Added this use-case to general discussion of: https://wiki.tcl-lang.org/page/TWAPI

    Thank you all,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)