cmd script that restarts explorer doesn't restore taskbar and desktop icons - cmd

The Win10 taskbar sometimes stops autohiding (due to conditions covered elsewhere). A common fix is to start the Task mgr, kill Explorer, then File/Run new task/explorer.exe.
I'd like to do this via a batch script. However, this code:
taskkill /f /IM explorer.exe
timeout <some number> [if this was necessary]
c:\windows\explorer.exe [or start explorer.exe]
only starts the File Explorer. It does not re-establish desktop icons nor the taskbar. How can a batch script emulate what the taskmgr's run new task does?
Tnx

Related

Closing only a window of an active application via .bat file

I am looking for a solution to close a window and leave the .exe running.
The .bat file:
#echo off
TITLE Bejelentkezes ujrainditasa
TASKKILL /F /im eszig-eid.exe
TASKKILL /F /im eszig-cmu.exe
start /d "C:\Program Files (x86)\ESZEMELYI\eSzemelyi_Kliens" eszig-cmu.exe
So, the eszig-cmu.exe must stay running, but when the code executes it opens the window of the program, and I don't need it. I want to close only the window of the application, like how I mentioned and leave the .exe (the active program) running! I also apply the solution in PowerShell! I only curious about the solution!

Handle "abandon unsaved data and shut down" from commandline when killing a process

I just got a windows command prompt to freeze and I could not close it from another terminal with taskkill /IM cmd.exe /T /F
I had to open task manager and and when trying to end the task got a pop up window where I add to check an "abandon unsaved data and shut down" checkbox, and then the terminal closed.
I would have thought the /F would deal with such things, but it does not.
How can I kill such a process from the commandline?

Close a Window in Windows Command Prompt

Hey I've got a quick question,
I know that you can start applications minimized through the command prompt with something like:
start /min "" "C:\Windows\notepad.exe"
However is there a way to automatically close the window, now I don't mean kill the process/task. Just close the window. In notepads case this would work the same way as killing the process, but in something that will minimize to a system tray on a window close, like Skype, or Discord for example this wouldn't kill the process but instead just put the task away from sight.
Thanks
This is not possible in batch files alone, instead this script creates a temporary VBScript at %temp%\hidden.vbs and then passes arguments to it using wscript.exe
This script doesn't minimise it or send it to the system tray, it just hides it and is only visible in Task Manager
#echo off
(echo CreateObject^("Wscript.Shell"^).Run """" ^& WScript.Arguments^(0^) ^& """", 0, False) > "%temp%\hidden.vbs"
set launch=wscript.exe "%temp%\hidden.vbs"
%launch% notepad

Running an .exe after another closes using .bat file

I'm playing an old game that conflicts with the Windows Graphical Shell for Windows 7 and doesn't allow it to display properly so I simply go into Task Manager (TM) and close explorer.exe and the game displays fine but in order for me to enable explorer.exe I need to go into TM and start a new task for it to come back. I was wonder if there was a way to write a .Bat file that would kill explorer.exe launch my game and once the game closes it would simply run the task for me instead of manually needing to turn it back on.
taskkill /f /IM explorer.exe
start CNC95Launcher.exe
this is what i have so far
The start causes windows to launch your program asynchronously - that is, it will start it, then continue with the next instruction without waiting for your app to close.
Try this:
taskkill /f /IM explorer.exe
start /wait CNC95Launcher.exe
start explorer.exe
You probably don't actually need the start for explorer, because it's that kind program.
I use this (on window 7):
taskkill /F /IM Explorer.exe
*.exe
Start explorer.exe
replace * with the exe name that launches the actual game not a pre launch menu and save as .bat in the same folder directory.
It works for Star Wars Galactic Battlegrounds and AoE which can suffer weird colour issues if explorer runs.

Windows 8.1 unable to run batch file without command prompt flashing

I have scheduled a task to run a batch file, and currently every time the task executes, there is a command prompt box that flashes. This is very undesirable. The node.js command prompt window executes minimized correctly, it is the windows command prompt that flashes.
Here is the action that the scheduled task runs:
cmd /min /c "C:\Users\computeruser\Building Intelligence\javadobe\runCheck.bat"
and here is the contents of the batch file, (probably unnecessary to show, but I was originally trying to run these commands straight from the task scheduler. Putting them in this batch file instead has got me closest to what I actually want to happen: run a javascript file with node.js minimized):
cd "C:\Program Files (x86)\BuildingIntelligence\javadobe\" & START /MIN node index.js /exit
A list of the commands I've tried:
cmd.exe /c start /min "C:\Users\computeruser\Building Intelligence\javadobe\runCheck.bat"
cmd.exe /c start /min "C:\Users\computeruser\Building Intelligence\javadobe\runCheck.bat" & /exit
%comspec% /c start "" /min "C:\Users\computeruser\Building Intelligence\javadobe\runCheck.bat"
all of these commands leave the command prompt box open, not closing it but minimizing it after it opens. There is also a notification that says "not enough storage is available to process this command".
I need to run this task with the highest privileges, and while it needs to be invisible most of the time, it needs to be able to show a dialog box occasionally when the task is run.
Thanks in advance for any help!
Basically, if what you have tried doesn't work, you're going to need a third party tool. NirCMD should do it and it's freeware.
NirCMD exec hide "C:\Users\computeruser\Building Intelligence\javadobe\runCheck.bat"
At the bottom of this page there is a link for the download. This page covers what the tool is capable of.

Resources