It is currently April 23rd, 2024, 8:27 pm

Trying to run a task minimized

Get help with creating, editing & fixing problems with skins
paplaukes
Posts: 2
Joined: July 14th, 2017, 3:07 pm

Trying to run a task minimized

Post by paplaukes »

Hi,

I have a shortcut to kill a program before launching another one. This works:

Code: Select all

LeftMouseUpAction=[taskkill /fi "WINDOWTITLE eq somewindow"]
I'm trying to make it run minimized, so taskkill/command prompt window doesn't pop up. This doesn't work:

Code: Select all

LeftMouseUpAction=[start /MIN taskkill /fi "WINDOWTITLE eq somewindow"]
How come? I tested both commands, they both work in command prompt or when launched as .bat file. I tried putting quotes everywhere, but nothing. I also saw there's runcommand plugin, just looking for a one line solution if possible.

Thanks for looking :)
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trying to run a task minimized

Post by jsmorley »

Any call to anything that is a console command in Windows, like taskkill.exe, will always pop up a cmd.exe console window, even if for just a second.

There is no way around that other than the RunCommand plugin which can run console commands as "hidden".

Minimized won't help, as when you execute a command like taskkill.exe, it is being executed as a shell command passed through cmd.exe. While it is all well and good to tell taskkill.exe to start "minimized", that doesn't really mean or do anything. taskkill doesn't have a user interface or window. It is just run by cmd.exe, which WILL pop up its window. In reality, it's the "start" command, which is built into cmd.exe, that is starting the console window.

Long and the short of it is that you must use RunCommand.
paplaukes
Posts: 2
Joined: July 14th, 2017, 3:07 pm

Re: Trying to run a task minimized

Post by paplaukes »

Thank you. I saw there's no easy way to do hidden command line stuff. Tried minimizing the window at least. Problem was, Rainmeter did not understand 'start' so did not execute it. Calling bat file worked and made console window disappear much quicker:

Code: Select all

@echo off
@start /min taskkill /fi "WINDOWTITLE eq %1"
Then went on to a python script for full invisibility. If I was making a skin for sharing, would go for RunCommand instead.