What's new

Win 10 Taskbar in Fullscreen workaround (not Auto-Hide)

shaggygoblin

New member
Joined
Jun 18, 2014
Messages
11
Reaction score
0
When I upgraded (downgraded?) my Win7 to Win10TP, taskbar always stayed on top of windowed fullscreen and fullscreen apps/games, including PG. I rolled back to Win7 and all was fine. Until the anniversary update was forced on me... Initially I sent a ticket to SS under the assumption that maybe there was a tweak they needed to make in the code to overcome this. The response i got was to just turn on auto-hide in the taskbar settings.
OK, fair enough. However this doesn't cut it for me. So I dusted off my old diskette of tricks...

The taskbar is tied to explorer in later Windows versions and cannot be killed separately from the desktop like in days of old, so I banged out this .bat (for the younguns reading, that's old-school Batch scripting from the days of the Disk Operating System, or DOS) that will 'relatively safely' end the desktop/taskbar, launch PG, and wait for further input from the user. It presents the option to relaunch pg or exit and relaunch explorer. Run it and it will open a console (cmd.exe aka Command Prompt). In the console it will show you what it's doing. It will close the explorer instance tied to the desktop/taskbar and leave other folder windows open. Browsers, media players, and the like will be unaffected), and launch PG. It will stay open, should the need arise for you to kill/restart the PG client, as most of us undoubtedly must do after a while, so that you may make a choice: Relaunch PG or relaunch explorer (desktop/taskbar) and exit the console. If you relaunch PG, it will again wait. Only when you choose to exit will it launch explorer and exit.
There are actually 3 versions in the file: Flavor, Bland, and Water. They are commented and attached individually as well. You MUST get the path to your Launcher.exe and add it into these in place of mine, as my Launcher.exe is not in the normal location...lol.

(Can't attach .bat files directly, so I zipped them with 7zip. If that's a problem, the .zip, then go ahead and press the power button and go find your crayons.)


EDIT: Since incorporating the suggestion from HGus, enabling the isolation of the desktop/taskbar process, the '.zip' format has been disabled as an acceptable file extension for attachments. The contents of the code can be copy/pasted to a notepad and saved as a .bat, then ran the same way you run any executable (.exe).


View attachment Flavor.zip
This is the Flavor.bat code (contains the other two commented out as well):
Code:
@echo off
:: Flavor
:: Windows 10 TP/Insider/Anniversary taskbar stays 'on top' of many fullscreen and windowed fullscreen games/apps.
:: In effect, you cannot interact with anything in the game/app UI, like buttons and such, displayed behind the taskbar.
:: Setting the taskbar to 'Auto-Hide' doesn't work for me, as I must access things in the area that causes it to 'unhide'.
:: Using this .bat kills the desktop/taskbar instance of explorer.exe and launches PG.
:: As well, I have the choice to relaunch if I have to restart the PG client due to stuttering/lag after a time.
:: I have many of these to launch various games/apps.  One .bat has 5 things that can be chosen.
:: All of them end by launching the desktop again (explorer.exe) and closing the cmd.exe window.

echo Killing the Desktop/Taskbar Explorer.exe Instance
:: NOT Including open 'File Explorer' windows.  TYVM, HGus for the suggestion!!
for /f "tokens=2,10" %%p in ('tasklist /nh /v /fi "imagename eq explorer.exe"') do if "%%q"=="N/A" taskkill /f /pid %%p
:: It must be mentioned, this is NOT the recommended way to close explorer.exe for various non-harmful reasons.
echo ----------------------------------

echo Launching Pirate Galaxy
:: Place your path here use "" if spaces in path.  C:\"your path"\some.exe or "C:\your path\some.exe"
D:\"Splitscreen Studios"\"Pirate Galaxy"\Launcher.exe
echo ----------------------------------

:start
echo Running Flavor Batch
echo ***************************
echo * Have you podded enough? *
echo ***************************
echo  1) (Y)es, Launch Explorer and exit
echo  2) (N)o, Relaunch Pirate Galaxy
set /p op=Ready to call it quits?:
if /I "%op%"=="N" goto P
if /I "%op%"=="Y" goto E
:: use /I to make it ignore UPPER/lower case when pressing y/Y or n/N
if "%op%"=="1" goto E
if "%op%"=="2" goto P
:: 1 or 2 are acceptable as well
cls
echo Really?! Try again...
echo Please use 1, 2, Y, or N
goto start

:P
echo Launching Pirate Galaxy
"D:\Splitscreen Studios\Pirate Galaxy\Launcher.exe"
cls
goto start

:E
echo Exiting and Launching Explorer.  Goodbye!
start C:\windows\explorer.exe
goto exit

:exit
@exit

View attachment Bland.zip
The Bland.bat code:
Code:
@echo off
:: Bland
:: The following will get you the same thing without the flavor.
echo Running Bland Batch
for /f "tokens=2,10" %%p in ('tasklist /nh /v /fi "imagename eq explorer.exe"') do if "%%q"=="N/A" taskkill /f /pid %%p
"D:\Splitscreen Studios\Pirate Galaxy\Launcher.exe"
:start
echo (1) (E)xit
echo (2) (P)lay
set /p op=?:
if /I "%op%"=="E" goto E
if /I "%op%"=="P" goto P
if "%op%"=="1" goto E
if "%op%"=="2" goto P
goto start
:P
"D:\Splitscreen Studios\Pirate Galaxy\Launcher.exe"
cls
goto start
:E
start C:\windows\explorer.exe
exit /b

View attachment Water.zip
The Water(ed down).bat code:
Code:
@echo off
:: Water
:: kills desktop/taskbar explorer instance, launches PG, waits, relaunches explorer and exits console.
:: It will stay in a waiting state untill you hit enter inside the console(cmd.exe window).
:: No game relaunch option.
for /f "tokens=2,10" %%p in ('tasklist /nh /v /fi "imagename eq explorer.exe"') do if "%%q"=="N/A" taskkill /f /pid %%p
"D:\Splitscreen Studios\Pirate Galaxy\Launcher.exe"
pause
start C:\windows\explorer.exe
exit /b
EDIT:
HGus contributed a working suggestion to get the .bat's to only close the desktop/taskbar instance of explorer.exe leaving any other folder view instances of explorer open. I believe you do still need to enable 'Open folders in a separate process' and/or 'Display the full path in the title bar'.
Folder Options.png
 

shaggygoblin

New member
Joined
Jun 18, 2014
Messages
11
Reaction score
0
To the GM's/CM's/Dev's:
Please move this to Tips & Tricks or sticky as you deem appropriate, if this helps the community.
You may also modify the post and/or file contents as you see fit before doing so.
No credit is required or due, cheers!

Shaggygoblin

Edit: PG has crashed no more or less while using these and in no different manner as does happen when explorer is running and PG is launched in the normal way. Also of import, with explorer killed, error logs do still get completed and delivered to the appropriate folder when using these to launch PG.
 

HGus

Well-known member
Joined
May 17, 2011
Messages
926
Reaction score
180
Server
Aeria
Main Pilotname
HGus
Good job! So simple workaround that nobody else realized before. Excellent idea.

Killing only the "Desktop/Taskbar" instance only works if you enabled "Launch folder windows in a separate process" in "Folder options". Then you can use:

Code:
for /f "tokens=2,10" %%p in ('tasklist /nh /v /fi "imagename eq explorer.exe"') do if "%%q"=="N/A" taskkill /f /pid %%p
As folder windows always have a window name, this will kill the "N/A" named instance, which is the desktop.

Source: http://superuser.com/a/434096
 

shaggygoblin

New member
Joined
Jun 18, 2014
Messages
11
Reaction score
0
EDIT:
HGus was correct. After some rest and background distractions were terminated (no, I didn't kill anyone...lol), I managed to get it to work, on my pc.

By modifying the taskkill options correctly, i was able to get it to close only the desktop/taskbar instance of explorer with one or more (up to 12 random folders open) and several (5+) apps running, without fail/error, over 30 times.

I will add the changes, and HGus gets credit for the suggestion!! Cheers!

Code:
for /f "tokens=2,10" %%p in ('tasklist /nh /v /fi "imagename eq explorer.exe"') do if "%%q"=="N/A" taskkill /f /pid %%p
HGus,

In short, what you suggest is a little (read WAY) ahead of my dusty/rusty skillz...lol.

There are several/numerous ways to do it so it won't kill any open apps/windows except the desktop/taskbar instance of explorer.exe; HOWEVER.....(LMAO!) given the way different versions of windows work now, and the fact that finding the explorer PID with windowtitle = N/A doesn't work (at least not in my attempts), finding a universal solution is beyond my current skill.

Taskkill is not available on Win10 basic/home, if I recall correctly (I use Win10 Pro upgraded from Win 7 64 Ult.)... TSkill is reported to exist on basic/home but i am not familiar with it. Also, I cannot get the tasklist to 'filter inside a filter' to single out the no windowtitle process in order to extract the PID in a manner akin to this: /fi imagename eq explorer.exe > /fi windowtitle eq N/A OR /fi windowtitle ne *:\* (no way to say "any drive\path" as it errors on the wildcard for the drive letter) and I am unfamiliar with a way to search for command line arguments, as folder windows (on my pc at least) are given a command line argument like this (my PG install folder, as seen in taskman):
Code:
C:\Windows\explorer.exe /factory,{some-five-section-hash-string} -Embedding
You can see this by opening (win10) task manager, > details > right click any column header and select 'show columns'. scroll the list and check the 'Command line" entry and click ok. You may need to adjust the column header widths to see all the text by dragging the separator to the right of the text in the header 'Command line'.
Explorer Instances.png
Until anyone with way more logic than me (not asking much there) can regex a list/sort/find/extract to run ahead of the taskkill... these .bat's 'will' work as is without harmful effects sans closing any open folder windows. Again, browsers, media players, ...anything not labeled as 'explorer.exe' will not be closed and will remain functional.

Also, If anyone does have a working script that will isolate the desktop/taskbar explorer.exe instance and/or extract the PID for it to pass to the taskkill; feel free to take the initiative to modify the Batch script and reply with the changed code (in code tags), or just attach the .bat to to your reply, and I will edit the OP to add the code/file and credit the pilot(s) for their contribution.

(Please forgive any inconsistency/grammar/spelling. It's late and there's a lot of commotion going on in the background here...lol... hard to think coherently.)
 

HGus

Well-known member
Joined
May 17, 2011
Messages
926
Reaction score
180
Server
Aeria
Main Pilotname
HGus
Sorry for a little mistake.

"N/A" means "not available". I found that this string is dependant on system localization. By instance it is "N/D" in my Spanish setup. Try:
Code:
tasklist /nh /v /fi "imagename eq explorer.exe"
in your system to find out how it was translated (look at the last token).

I have Windows 10 Home x64 and both "taskkill" and "tasklist" are available.

I suggest to name the script with a .cmd extension instead of .bat cause some minor changes in the behaviour of some internal commands can raise incompatibilities.

Note that my suggested change was only a line in your script. You can read an explanation of what it does in the superuser.com link. But basically it uses a "for" statement to extract the name and pid from the filtered "tasklist" output and execute "taskkill" with the correct value.
 

shaggygoblin

New member
Joined
Jun 18, 2014
Messages
11
Reaction score
0
HGus said:
Sorry for a little mistake.

"N/A" means "not available". I found that this string is dependant on system localization. By instance it is "N/D" in my Spanish setup. Try:
Code:
tasklist /nh /v /fi "imagename eq explorer.exe"
in your system to find out how it was translated (look at the last token).

I have Windows 10 Home x64 and both "taskkill" and "tasklist" are available.

I suggest to name the script with a .cmd extension instead of .bat cause some minor changes in the behaviour of some internal commands can raise incompatibilities.

Note that my suggested change was only a line in your script. You can read an explanation of what it does in the superuser.com link. But basically it uses a "for" statement to extract the name and pid from the filtered "tasklist" output and execute "taskkill" with the correct value.
Localization may be the only real issue with these. I had to correctly tell tasklist what to do. If you look at the script as it is now and compare it to what you linked, you'll see the difference. I have no idea if a non-US localized instance of cmd.exe will correctly interpret the commands. Again, they are out there now, and anyone is welcome to add-to/modify as needed for compatibility.
 

HGus

Well-known member
Joined
May 17, 2011
Messages
926
Reaction score
180
Server
Aeria
Main Pilotname
HGus
Yep, sorry again if I complicated too much your excellent approach. Just old school coder forgetting that not everybody is a programmer. ^^

Good job. :sneaky:
 
Top