I have got a .bat file to update some folders and programs etc into Windows NT stations' START MENU. It works actually BUT noted sometimes I NEED to do a PC logoff and relogin before I can see the START MENU being updated with my changes. Doing a refresh doesn't work.

Really suspect it's got something to do with Windows behavior...or even the registries (which I know NUTS and been told before that such are not advisable to touch if one is not sure of what these registries meant..) Any expet can help answer & resolve my this problem??

HELP !!! :sad:

Dani AI

Generated

Short answer and likely cause: Explorer caches the Start Menu view and only re-reads it when the shell is told the folder changed (or when Explorer restarts / the user logs off). That explains why some machines show changes immediately while others only after logoff/logon. Also check whether your script writes to the per-user Start Menu or the All Users (common) Start Menu — the location changed between NT/XP and later Windows versions, so use the proper known-folder (%APPDATA% for per-user, %ALLUSERSPROFILE% / %ProgramData% for common). (learn.microsoft.com)

Practical fix you can add to the .bat (runs in the interactive user session): notify the shell after copying the .lnk by calling SHChangeNotify. A convenient modern way is PowerShell + Add-Type to P/Invoke shell32.SHChangeNotify, for example:

$code = @'
using System;
using System.Runtime.InteropServices;
public static class ShellNotify {
  [DllImport("shell32.dll", CharSet=CharSet.Unicode)]
  public static extern void SHChangeNotify(uint wEventId, uint uFlags, string dwItem1, string dwItem2);
}
'@
Add-Type -TypeDefinition $code
[ShellNotify]::SHChangeNotify(0x00001000, 0x0005, "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs", $null)

That tells Explorer “this folder changed” so the menu refreshes without logoff. See the SHChangeNotify API for details; note that rundll32 is generally not a reliable way to call SHChangeNotify — use a small helper or PowerShell/AutoIt/AutoHotkey approach. (learn.microsoft.com)

Caveat: if your installer/script runs as SYSTEM, from a service, or during imaging it may be running in a different session (Session 0) and notifications won’t reach the user’s Explorer process — the refresh must run in the user’s interactive session or Explorer must be restarted. For domain deployments you can run the refresh as a logon script or use per-user initialization (Active Setup) so the change is applied in each user session. (itprotoday.com)

Following up on ’s KiXtart suggestion: KiXtart is a lightweight logon-script interpreter you can use to copy shortcuts and trigger a shell refresh at logon; it’s commonly used for login automation in Windows domains. If you prefer Group Policy, use a user logon script or Active Setup to run a small refresh (the change must execute as the logged-in user to be immediate). Links: KiXtart docs and Active Setup reference. (studylib.net)

Quick troubleshooting checklist to add to the thread: confirm the .lnk actually appears in the correct Start Menu folder, check permissions, test creating a shortcut manually while logged in (does it appear immediately?), try the PowerShell SHChangeNotify call above, or restart explorer.exe as a last resort.

If you use a roaming (or mandatory) profile, this would account for that, since roaming profiles are only updated on save, i.e. logout.

No, the PCs are not with roaming profiles. There isn't a consistency...some are ok ie start menu will get updated immediately but there are some which will see the updates only after performing a logoff and re-login. Any idea what is the actual cause and how to actually fix this problem such that I don't need to logoff and re-login in order to view the start menu updates ?? ;)

Will. it sounds like explorer is caching the Menu. You can try using KiXtart and see it that helps.

That's why i am wondering if it has got anything to do with the registers... :sad: btw, what's KiXtart? :o can oso kindly explain how to use this and where to get it ? :cheesy:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.