I would like to know how/if it is possible to close a specific browser window from the command line. Say i have 4 windows open for different sites and I want to only one. What would be the command if browser is safari?
Thanks
If you only want to close Safari, you can use:
Taskkill /IM Safari.exe /F
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
At first, the Windows explorer.exe was closed and the desktop screen went black. My program needs to start explorer.exe. This is I tried:
QProcess process;
process.execute("explorer.exe");
The problem is this only pops up a new explorer window instead of reactivating the desktop explorer (turn the black screen back to desktop). It should behave just like when you run explorer.exe after you kill it in cmd or powershell.
Solution found:
QProcess::startDetached("explorer.exe"); //Wrong
QProcess::execute("C:\\Windows\\explorer.exe"); //Wrong
QProcess::startDetached("C:\\Windows\\explorer.exe"); //Right
If anyone knows why explorer.exe behaviour like this, please share it.
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.
Is there a command on the Windows terminal to close the window of an active application without actually killing the task/process?
What I'm looking for is something similar to clicking the 'X' button on the application window's name bar, or hitting Alt+F4 on it.
Any help would be greatly appreciated. Thanks!
I don't want the taskkill command because it terminates the process. I don't want it to terminate, say I want to close a Skype window so that it pops up in my Notification Tray on my Taskbar.
I couldn't find a specific command on the Windows terminal to do what I wanted, but I found this VBScript code online that did the trick for me.
set shell = createobject("wscript.shell")
shell.appactivate("Skype for Business")
shell.sendkeys "%{F4}"
This simulated an Alt+F4 keypress to Skype, which effectively closed the window and sent it to my Notification Tray.
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.