Improvement of processes for creating pins and copying links @ PE startup

A place to discuss WimBuilder

Moderators: Lancelot, slore

Post Reply
HeyJoe
Registered User
Posts: 81
Joined: Sun 06 Jun, 2021 12:49 pm
Location: Germany

Improvement of processes for creating pins and copying links @ PE startup

Post by HeyJoe »

Hi Slore,

May I ask you to make changes to two batch files to ensure smooth operations
when copying shortcuts and creating pins.

1.: See "%_CUSTOMFILES_%\PEMaterial\Autoruns\Startup\PinShortcuts.bat"
When switching from the user who logged in first (Admin or SYSTEM) to the other (SYSTEM or Admin)
then all user-made pins created by "call PinToStartMenu ..." and "call PinToTaskbar ..."
(they are the content of "PinShortcuts.lua")
are missing because of line #1 "set RunOnce=1" in "PinShortcuts.bat"

So let's exclude the file "%_CUSTOMFILES_%\PEMaterial\Autoruns\Startup\PinShortcuts.bat"
from being renamed by "%_CUSTOMFILES_%\PEMaterial\Autoruns\Runner.bat" after its 1st run at PE startup:

line #1

Code: Select all

set RunOnce=1
Should be

Code: Select all

set RunOnce=0
or

Code: Select all

rem -- set RunOnce=1
or deleted.


2.: See "%_CUSTOMFILES_%\PEMaterial\Autoruns\Startup\BeforeShell\CopyShortcuts.bat"
Add xcopy.exe command parameter (especially the /H - e.i.: include "Hidden" and "System" attributes)
Otherwise, when switching from the initially active Admin account to the SYSTEM account, some shortcuts within folders with the "hidden" and/or "system" attributes will be missing.

Ex.: "X:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\*.lnk"
and: "X:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools\*.lnk"
where I have placed shortcut at build time.

Line #6 and #7

Code: Select all

xcopy /s /y "X:\Users\Administrator..."
Should read at least:

Code: Select all

"Xcopy.exe /s /h /y "X:\Users\Administrator..."
or better yet:

Code: Select all

"Xcopy.exe /k /r /e /i /s /c /h /q /y "X:\Users\Administrator..."
More parameters:
I am sure that the additional parameters I have added can only be useful.

What do You think about it?

See You
.
HeyJoe
Registered User
Posts: 81
Joined: Sun 06 Jun, 2021 12:49 pm
Location: Germany

Re: Improvement of process for creating pins @ PE startup

Post by HeyJoe »

Hi Slore,

Well, the following proposal for renaming might have a touch of the cosmetic about it.

It changes the alphabetical execution order by "%X_PEMaterial%\Autoruns\Runner.bat" at PE runtime in the manner,
that user-made StartMenu Pins and Taskbar Pins (written to "%X_Startup%\PinShortcuts.lua")
will be visible much earlier - specifically, right after those from "00-InitPinIcons.lua",
which results in an almost seamlessly appearance of Starmenu and Taskbar pins created by both sources:
"00-InitPinIcons.lua" and "PinShortcuts.lua".

That looks a bit smoother to me.
Well, as is known to this day, pinning to the taskbar only works in versions <= 22H2 [22621.2428]-Oct.2023 :(

So, let's rename "%_CUSTOMFILES_%\PEMaterial\Autoruns\Startup\PinShortcuts.bat" to "01-PinShortcuts.bat"

Are there any disadvantages?
Do You agree with that?

See You
.
Last edited by HeyJoe on Sun 02 Aug, 2026 3:26 pm, edited 1 time in total.
slore
Code Baker
Posts: 108
Joined: Sun 06 Jun, 2021 12:00 pm

Re: Improvement of processes for creating pins and copying links @ PE startup

Post by slore »

>Well, as is known to this day, pinning to the taskbar only works in versions <= 22H2 [22621.2428]-Oct.2023 :(

WinXShell.v2026.08.08 will add a "PinEx" mode to fix that. Use this mode, just xcopy the *.lnk files will pin the icon to the taskbar.
taskbar pinned items, will like the desktop shortcuts, just copy the lnk files to SYSTEM or Administrator account.
Post Reply