In response to what Libor Striz
<poutnik4R...@gmailCAPITALS.com.INVALID> wrote :
> Not speaking for the author,
> but it is an elegant method,
> if what you want is regular scheduled running.
>
> If you need running on demand,
> like invoking an action by an application,
> the VBS method in my other post
> is the way to go.
Hi Poutnik,
The goal is to help me, and everyone, who wants a silent script running.
As always, we want the most elegant solution possible, native if possible.
Bear in mind I have _never_ before run a script silently using the task
manager, so take anything I say in this thread with a huge grain of sul.
Generally, I just run scripts openly, on demand.
But having the tzrandom.bat script in my face 24/7 is obnoxious, so when I
googled for how to hide it, I found so many solutions that I asked which
one to focus upon of people who might know offhand which they prefer.
JJ kindly suggested the native task scheduler, which fits with my MO of
using native stuff as much as possible (freeware otherwise).
To your point, focusing on the native task scheduler, I do note it has an
option to allow manual invocation to run it on demand, which you can see as
the first item on the left side "Settings" tab in the previous screenshot:
<
https://i.postimg.cc/8z6NC7BC/tz05.jpg>
It seems that option allows _both_ automatic & on-demand invocation,
doesn't it?
[x]Allow task to be run on demand
See also at the bottom of that same screenshot:
If the task is already running then the following rule applies:
[Do not start a new instance]
Where other options on my Windows 10 Pro system are:
[Run a new instance in parallel]
[Queue a new instance]
[Stop the existing instance]
This is another test you can try if you like:
Start > Run > taskschd.msc > Create Basic Task...
Name: cmda
Description: Open an unmistakably red command window as administrator
Trigger: (o)When I log on
Action: (o)Start a program
Program/script: C:\app\os\pgm\bat\cmda.bat
Finish: [x]Open the Properties dialog for this task when I click Finish
At this point, you have a ton of potentially useful settings:
o General tab
o Triggers tab
o Actions tab
o Conditions tab
o Settings tab
o History tab (disabled)
The elegant cmda.bat script is included in the sig to facilitate testing.
o Efficient Windows Admin command prompt of any color in any desired location
<
https://groups.google.com/d/msg/alt.msdos.batch/PFke17AzS78/NSLlZJebCwAJ>
--
@ECHO OFF
rem cmda.bat opens a new shell to "Run As Administrator"
rem based on a script by foxidrive found on alt.msdos.batch 7/7/2018
SETLOCAL ENABLEEXTENSIONS
IF NOT "%~1"=="" goto :START
SET LogFile=%TEMP%\cmda.vbs"
Echo Set UAC = CreateObject("Shell.Application") >"%LogFile%"
Echo UAC.ShellExecute "%~f0", "%cd%", "", "runas", 1 >>"%LogFile%"
Start "" /MIN "%LogFile%"
goto :EOF
:START
Cmd /k "CD /D "%*" & Echo Administrator: & color 4F"
:EOF