How would you minimize a running windows service using batch file or cmd lets say firefox.exe to start up and run minimized or minimized to system tray?
You call start /min firefox it will start minimized. However theres a caveat dont do this with Firefox window open because then it will not do this, unless you start a new session. There is no way for batch to start things in the system tray unless the software itself has switches for this. But then that's not a batch issue
Related
I want to close a window but not app it self (it is running in tray)
There app I need to minimize to tray but there no option to do it in app settings. So I was trying to write bat script to to that.
I got this so far:
:: open app
START C:\"Program Files (x86)"\APP_NAME\APP_NAME.exe
:: close window but not app (doesn't work, kills entire app)
taskkill /fi "windowtitle eq APP_NAME"
You could use nircmd.exe hide in order to hide the desired window. See the following two pages:
NirCmd - Windows command line tool
NirCmd Command Reference - win
I have a ruby script that displays it's progress via the cmd and completes in about 10 minutes. In the last few weeks the cmd seems to freeze and after 10 minutes when I click on the cmd window it then completes the script.
I have searched on forums and suggestions include: disable QuickEdit Mode & Insert Mode which I have done but this has not fixed the problem.
The platform is an azure windows server 2016 VM.
Could this problem be due to a recent windows update?
Thanks
If you are using the usual Windows Command Window, Ruby has no way of knowing that you have clicked into the Window, so it is unlikely that it is related to the code. However, Windows does block a command to write to the command window on certain circumstances, and if this happens, Ruby waits on, say, STDOUT.puts, until it is allowed to continue. Of course this applies not only to Ruby, but to any application writing to the command console.
The most typical situation, in which this occurs, is, if you (maybe accidentally) select with the mouse something in the console Window. The script running in the console is blocked. By clicking with the mouse inside the window, the selection is cancelled, and the program continues to run.
I'm trying to open a browser with vbs program on background. My program code is this:
CreateObject("Wscript.Shell").Run "firefox.exe",0,True
The problem is that the window that opens isn't hidden. Also if I open any other program this way it runs on background eg. if I replace firefox.exe with notepad.exe. what's wrong? Thanks
Browsers often have many processes for UI and pages. It's likely the first firefox.exe only serves as a launcher, and it opens subsequent instances of firefox.exe that actually provides the UI. So unfortunately you can't hide the window with your current implementation.
I have such problem. I've got Hanvon graphic tablet on a dual-display system. There is an option in tablet settings to select a display to work with, but I do need an opttion to switch monitors on the fly without entering options.
I've found out, that there is some file HWTabletFind.hou that controls the options. So, i've copied two versions of this file - each for one display. And created a *.bat file
#echo off
ren switch.hou temp.hou
ren HWTabletFind.hou switch.hou
ren temp.hou HWTabletFind.hou
taskkill /F /IM Jwpen.exe
start c:\windows\jwpen.exe /runtablet
HWTabletFind.hou is a running options file,
switch.hou are the options for other monitor
jwpen.exe is a process that controlls tablet.
Now the problem: everything works fine, displays are switching. But when I restart jwpen.exe process, all my applications (e.g. Photoshop) do not see my tablet anymore. Tablet works, but in "mouse mode" - no pressure, no tilt, etc. If I restart application, it sees tablet again.
I think, jwpen.exe must run on application initialisation. If it stopps, app thinks, that tablet is disconnected and does not see it again on jwpen.exe start.
Is there a way not to kill and start a process, but to reset it in some way?
If I change display from tablet settings panel, everything works ok. So it's possible to do it via custom script, to run it via hotkey without opening settings.
AutoIt can help to press and click buttons in a script, Autohotkey can do the same by a hotkey, and SENDKEYS via a VBS script can press keys in a GUI too.
I run a batch file as part of Windows XP startup which executes continuously until Windows closes. It calls a VBScript file, which executes SendKeys "+{ESC}" (Shift+Esc). This gets picked up by 4t Tray Minimiser to send the CMD window to the system tray. Most times it works, but occasionally the CMD window stays visible.
Upon searching, various posts seem to suggest the .VBS file is losing focus or it's a timing problem. Some suggest AppActivate but I can't work out how to achieve what I want. Even the examples given for AppActivate seem like a lot of work.
Did you check the documentation? It's actually rather straightforward. You call AppActivate with the title (or part of the title) of the window you want to bring to the foreground, then run SendKeys to send keystrokes to the foreground window.
Set sh = CreateObject("WScript.Shell")
sh.AppActivate "window title"
sh.SendKeys "+{Esc}"