Are you frustrated with your ComfyUI install because you can't pin to the taskbar?
This article solves just that.

Background
This is my obligatory technical explanation. If you don't care about it and just want to follow the step by step guide, skip to the next section.
Why couldn't you just drag the .bat file to the taskbar?
You probably even tried with a shortcut to the .bat and it didn't work.
We can only pin executable binary files to the Windows Taskbar, that means programs, compiled executables.
The .bat file is a script file, a text executable in a way, not a program.
That script is actually calling the python binary executable of the virtual environment for ComfyUI portable.
We need to trick Windows to let it pin our shortcut.
Step by Step guide
Step 1: Pretty icon
Vanity first. We want a pretty icon on the taskbar.
There is no real official logo, so just grab an image that represent ComfyUI for you.
I took the avatar of the repository.
Resize to a square. Crop to a circle. Resize to 256x256. Convert to a
.icoicon file.
I use the command line utility called imagemagick to do all that with one command. You can use Photoshop or GIMP or what ever you like.
I provide my icon .ico file in the attached zip file.

Step two: Edit your bat script
After we pin our shortcut to the taskbar, our .bat will be called in a different manner by Windows. We need to edit the file to make sure it launches properly.
If we do not, ComfyUI will be called inside C:\Windows\System32 and break. It's also dangerous for your computer.
I run on a Nvidia GPU, so I edit the run_nvidia_gpu.bat file. You might need to edit the run_cpu.bat.
Edits
Here is the list of what to change, then I will give you 3 examples:
Make a backup copy of the
.batfile.If ComfyUI is installed on
C:, skip to 2. If the drive is notC:your first line will set the drive. I set mine toG:.On a new line change directory with the
cdcommand, followed by the path to your ComfyUI install. For me it iscd "G:\ai-image\ComfyUI_windows_portable"On the same line we use the
&operator to chain call ComfyUI.\python_embeded\python.exe -s ComfyUI\main.py. You will have to add--windows-standalone-buildfor ComfyUI portable.Finally, we can add some optional configuration changes to ComfyUI:
I change the input directory location
I change the output directory location
I ask ComfyUI to behave as a local server so that I can open the GUI on my phone in my home network. For that I add the host (listen) and the port.
Examples
Required changes — if you installed on the same drive (C:)
cd "C:\ai-image\ComfyUI_windows_portable" & .\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
pauseRequired changes — if you installed on another drive (example G:)
G:
cd "G:\ai-image\ComfyUI_windows_portable" & .\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
pauseMy .bat file looks like this:
G:
cd "G:\ai-image\ComfyUI_windows_portable" & .\python_embeded\python.exe -s ComfyUI\main.py ^
--windows-standalone-build ^
--listen 192.168.2.184 ^
--port 8188 ^
--output-directory G:\ai-image\out ^
--input-directory G:\ai-image\inputs ^
--preview-method auto
pauseStep 3: Make a shortcut
Right click the
run_nvidia_gpu.batfile (orrun_cpu.bat) and clickCreate a shortcut.Right click the shortcut and open its properties.

Change the icon, click
Change Icon...thenBrowse...to the location of the.icofile.
Step 4: Trick windows
Now to trick Windows into letting us pin a shortcut to a .bat on the Taskbar.
In the shorcut properties, add
explorer.exein theTargetfield, before the path to the bat file.

Save and close with OK.
Right click on the Shortcut. You should have a new option
pin to Taskbar, click it.Do not test the Taskbar icon/shortcut yet.
Reopen the properties of the shortcut and delete the path to explorer in the
Targetfield.

Save and close with OK.
You're done.
You can now test your Taskbar Icon/Shortcut.
Conclusion
Congratulations, you tricked Windows to mind its own business.
One note before we part. The icon on the taskbar will launch ComfyUI , but the process will run inside a separate CMD window. The icon only works as a launcher.



