For the archives...
Given this will be permanently archived in websearchable archives, here are
updated screenshots which show the process in the detail to get it done:
<
Loading Image...> Setting up a printer spooler
<
Loading Image...> Setting up the hardware menu
<
Loading Image...> Setting up multiple commands
And here is the spooler icon I made, although you can use any desired icon:
<
Loading Image...> Printer spooler icon
While a few in this thread told the OP to "go search you idiot", I suspect
not a single one of those who said that has ever done the required task
because it demanded use of a half dozen specific Windows tricks to work.
It's always the case that those who say "lmgtfy" have never done it,
because I suggest that you will NEVER find all these tricks in one spot.
C:\data\sys\batch\spooler.bat
Win+R > taskschd.msc
task spooler=%comspec% /c start "" C:\data\sys\batch\spooler.bat
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\spooler.exe
C:\data\sys\batch\spooler.bat
Taskbar > menu > hardware > printer > spooler
C:\data\sys\link\spooler.lnk
Target=C:\Windows\System32\schtasks.exe /run /TN "task spooler"
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\spooler.lnk
C:\data\menu\hardware\printer\spooler.lnk
C:\data\sys\icon\spooler.ico
etc.
It's not something that is easily found in a Google search, in fact,
because about a half dozen tricks are involved when you want to pin an
administrative icon to a batch file on the Windows taskbar menu to start
and stop any Windows service (which required batch files, the registry,
and the task scheduler to do properly) using a variety of access methods.
Where "properly" is _always_ defined as you can access it any way you like.
Most of which take up _zero_ space on your Windows desktop GUI or taskbar.
Anyone should be able to set up Windows with only essential services
running, & then, when needed, they can start and stop additional services.
NOTE: I no longer use the default Windows menus because they're too easily
polluted and too difficult to clean up after each program install/update.
Luckily, when you set it up the way I described, it's _never_ polluted!
Not only does it last forever, but it's portable, where I've ported my
EXACT Windows-XP menu folder (yes, the actual folder) to each subsequent
Windows version on many machines - and it works just fine on each of them!
All you have to know is how to set it up (but anyone who says you'll find
this setup in anything but my tutorials on the web, I challenge them to
find it as it took years elapsed time to learn all the tricks involved).
*Command in batch to start & stop the print spooler*
<https://groups.google.com/g/alt.comp.microsoft.windows/c/THfefCBM9zw/>
Once set up, it works for every service you could want it to work for.
And you have many consistent ways (all named "spooler") to invoke it.
For example (with a taskbar icon):
Taskbar > spooler
C:\data\sys\icon\spooler.ico
For example (with a taskbar pinned WinXP pullout menu):
Taskbar menu > Hardware > Printer > Spooler
For example (with a taskbar RUN icon & Registry AppPaths => taskschd.msc):
Taskbar > run > spooler [Enter]
For example (with a taskbar RUN icon & Registry AppPaths => spooler.bat):
Taskbar > run > spooler [Control][Shift][Enter]
For example (from the command line with the PATH set accordingly):
Win+R > cmd [Control][Shift][Enter]
C:\> spooler [Enter]
Where here are some of the details necessary to perform the task.
To make the shortcut and to run it as administrator:
C:\data\sys\link\spooler.lnk
TARGET=C:\Windows\System32\schtasks.exe /run /TN "task spooler"
COMMENT=C:\data\sys\batch\spooler.bat
Advanced=[x]Run as administrator
To make the scheduled task and to run it as administrator:
Win+R > taskschd.msc > Task Scheduler Library > Create Task...
Name = task spooler
Description = start/stop print spooler
Security options = [x]Run with highest privileges
Actions = New > Start a program
Program/script = %comspec%
Add arguments = /c start "" c:\data\sys\batch\spooler.bat
To make the RUN command and to run it as administrator:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\spooler.exe
@Default = C:\data\sys\batch\spooler.bat
If you point to the batch file, you need to run it as administrator:
Run -> spooler [Control][Shift][Enter]
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\spooler.exe
@Default = C:\data\sys\link\spooler.lnk
If you point to the link to the scheduled task, you can just hit enter:
Run -> spooler [Enter]
To run the command from the command line (assuming it's in your PATH):
Win+R > cmd [Control][Shift][Enter]
C:\> spooler [Enter]
To run the command from the Winxp-style accordion pullout menu:
C:\data\menu\hardware\printer\spooler.lnk
Taskbar > menu > hardware > printer > spooler
Create this batch file for the scheduled task to point to as admin:
C:\data\sys\batch\spooler.bat
@echo off
REM 20231223 spooler.bat v0.1 starts & stops the Windows print spooler
REM using admin-only commands suggested by Andy Burns & VanguardLH
REM in Usenet thread Message-ID: <um4j5t$1vls9$***@news.samoylyk.net>
REM creating a scheduled task as suggested by Zaidy036 in that thread
call sc query | findstr /i spooler
if %ERRORLEVEL% == 0 goto :Stop?
:Start?
set /p user_input=Spooler is not running. Start it?"
if %user_input%==y net start spooler
goto :Icon
:Stop?
set /p user_input=Spooler is running. Stop it?"
if %user_input%==y net stop spooler
:Icon
echo "Change shortcut icon color (red/green) depending on outcome"
exit 0
Create any icon you like & have Irfanview save as a 42x42px ICO file.
C:\data\sys\icon\spooler.ico (the background can be transparized)
As always, if you know more than I do, please add value to this quick
tutorial, especially if you can flipflop taskbar icon color as needed.
--
BTW, if anyone says you can google this and find it, you won't, so it
merely means they don't know how to get an administrator command on a
taskbar menu to work - they've certainly never done it - because if they
had done it - they'd never have said that it's easy to find in a search.