New Shell Integration PowerToy: Copy as UNC#46056
New Shell Integration PowerToy: Copy as UNC#46056RamblingGeekUK wants to merge 15 commits intomicrosoft:mainfrom
Conversation
Adds a new PowerToys utility that copies the UNC path of files and folders on mapped network drives to the clipboard via the shell context menu. When a user right-clicks a file on a mapped drive, the command resolves the drive letter to its full UNC path using WNetGetUniversalNameW and writes it to the clipboard. Components added: - CopyAsUNCLib: static lib with settings model and singleton - CopyAsUNCContextMenu: COM shell extension DLL (IExplorerCommand) registered via MSIX sparse package - CopyAsUNCExt: PowertoyModuleIface DLL loaded by the runner - Settings UI: Library types, ViewModel, XAML page, nav entry, localization strings, and serialization context registrations GPO support is stubbed (returns Unavailable) pending a formal GPO policy entry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove _enabledGpoRuleConfiguration field that was assigned but never read (GPO is stubbed to Unavailable; no conditional logic reads the field). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Register CopyAsUNCContextMenu sparse package for removal during uninstall alongside the other context menu packages. The DLLs and MSIX are automatically included in the installer via the existing WinUI3ApplicationsFiles component group. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Drop 'path' from all display strings for a cleaner, shorter name - Add CopyAsUNC.png to Assets/Settings/Icons/ so the navigation item shows the module icon Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Per PowerToys team feedback, Copy as UNC is not a standalone utility. Instead, integrate it as a 'Shell Integration' section on the File Explorer Add-ons settings page. - Remove CopyAsUNCPage, CopyAsUNCViewModel, nav entry, module PNGs - Remove ModuleType.CopyAsUNC (no longer a top-level module type) - Add IsCopyAsUNCEnabled property to PowerPreviewViewModel, writing to GeneralSettings.Enabled.CopyAsUNC via OutGoingGeneralSettings IPC - Add 'Shell Integration' SettingsGroup to PowerPreviewPage.xaml with a toggle for Copy as UNC - Replace CopyAsUNC-specific resource strings with FileExplorerPreview_ShellIntegration and FileExplorerPreview_CopyAsUNC_Enable entries The C++ module, runner integration, and settings library types are unchanged — only the Settings UI surface is affected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The CopyAsUNC module's enable/disable state is held in GeneralSettings, so no module-specific settings file or types are needed. Remove CopyAsUNCSettings, CopyAsUNCProperties, CopyAsUNCLocalProperties and their JsonSerializable registrations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Convert SVG icon to multi-size ICO (16/32/48/256px) and wire up the post-build copy step so GetIcon() can locate it at runtime from WinUI3Apps\Assets\CopyAsUNC\CopyAsUNC.ico. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Regenerated CopyAsUNC.ico with BMP-encoded DIB entries for 16/32/48px and PNG for 256px. Windows shell requires BMP encoding for small icon sizes in context menus; PNG-only ICOs fail to render. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ESRPSigning_core.json: add CopyAsUNCExt.dll, CopyAsUNCContextMenu.dll, CopyAsUNCContextMenuPackage.msix for code signing - CopyAsUNC.wxs: new installer fragment for Assets\CopyAsUNC\ folder (mirrors FileLocksmith.wxs pattern) - Product.wxs: reference CopyAsUNCComponentGroup - PowerToysInstallerVNext.wixproj: compile CopyAsUNC.wxs, restore .bk on post-build - generateAllFileComponents.ps1: generate file components for CopyAsUNC assets Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
|
@microsoft-github-policy-service agree |
Adds COPYASUNCCONTEXTMENU, COPYASUNCEXT, WNet, and INFOW to the spell-check expect list. These are preprocessor macro names and Windows API identifiers flagged as false positives by CI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@RamblingGeekUK errored with:
|
Run clang-format on CopyAsUNC C++ files and XamlStyler on PowerPreviewPage.xaml to comply with repo style enforcement rules. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
- Add ConfigureEnabledUtilityCopyAsUNC GPO policy to gpo.h, GPOWrapper.h/.idl/.cpp and wire up in PowerToysModule.cpp - Remove hardcoded self-signed cert signtool post-build step from CopyAsUNCContextMenu.vcxproj (CI pipeline handles signing) - Remove TODO comment from AppxManifest.xml (PowerToys.exe confirmed as correct placeholder for modules with no UI executable) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot resolve the merge conflicts in this pull request |
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.Unrecognized words (4)HREDRAW These words are not needed and should be removedACR ADate AOklab ASUS BOklab Chunghwa CSOT defaulttonearest diu EAccess EInvalid ENot EProvider FErase FInc FNumber FRestore Hann HHmmssfff Hostx HPhysical hredraw HSpeed HSync HWP IVO LPrivate Nanjing PHL QDS RAquadrant Tianma UBreak UError UMax UMin vcenter vredraw VSpeed VSync WNet XButton XDeployment XDimension XLoc XPos XSpeed XTimer YDimension YPos YSpeed YTimerTo accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands... in a clone of the git@github.com:RamblingGeekUK/PowerToys.git repository curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/cfb6f7e75bbfc89c71eaa30366d0c166f1bd9c8c/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/25166570397/attempts/1' &&
git commit -m 'Update check-spelling metadata'If the flagged items are 🤯 false positivesIf items relate to a ...
|
Adds Copy as UNC as a Shell Integration toggle under File Explorer Add-ons.
When enabled, right-clicking a file or folder on a mapped network drive shows a
"Copy as UNC path" entry in the Windows 11 context menu. Invoking it resolves the
drive letter to its UNC path (via
WNetGetUniversalNameW) and copies it to theclipboard.
Implemented as a Windows 11 sparse MSIX
IExplorerCommandshell extension,following the FileLocksmith pattern. The toggle lives in Settings → File Explorer
Add-ons → Shell Integration, per feedback from the PowerToys team.
PR Checklist
feature be placed under File Explorer Add-ons (Shell Integration section)
rather than as a standalone module — implemented accordingly.
Resources.resw:FileExplorerPreview_ShellIntegration.Header("Shell integration") andFileExplorerPreview_CopyAsUNC_Enable.Header("Copy as UNC").ESRPSigning_core.json— addedPowerToys.CopyAsUNCExt.dll,PowerToys.CopyAsUNCContextMenu.dll,CopyAsUNCContextMenuPackage.msixinstaller/PowerToysSetupVNext/CopyAsUNC.wxs— new installer fragmentfor
Assets\CopyAsUNC\folder cleanup on uninstall (mirrorsFileLocksmith.wxs)Product.wxs—CopyAsUNCComponentGroupreferencedPowerToysInstallerVNext.wixproj—CopyAsUNC.wxscompiled,.bkrestore added to post-build event
generateAllFileComponents.ps1— asset file component generation addedDetailed Description of the Pull Request / Additional comments
New files:
src/modules/CopyAsUNC/CopyAsUNCContextMenu/—IExplorerCommandCOM DLLregistered via sparse MSIX package. Reads enabled/extended-menu settings,
checks the selected item is on a mapped network drive (
DRIVE_REMOTE), resolvesUNC via
WNetGetUniversalNameW, and writes the result to the clipboard. Iconreturned from
GetIconas a multi-size.ico(BMP-encoded 16/32/48px + PNG256px) following the FileLocksmith pattern.
src/modules/CopyAsUNC/CopyAsUNCExt/—PowertoyModuleIfaceDLL loaded by therunner. Calls
RegisterSparsePackageon enable, deregisters on disable.src/modules/CopyAsUNC/CopyAsUNCLib/— static lib with settings model/singleton.installer/PowerToysSetupVNext/CopyAsUNC.wxs— WiX installer fragment.Settings UI changes:
EnabledModules.cs— addedCopyAsUNCbool property(
[JsonPropertyName("Copy as UNC")]).PowerPreviewViewModel.cs— addedIsCopyAsUNCEnabledbacked byGeneralSettings.Enabled.CopyAsUNC, sendsOutGoingGeneralSettingsIPC.PowerPreviewPage.xaml— added Shell IntegrationSettingsGroupwith toggle.toggle is the only control needed.
Questions:
AppxManifest.xmlusesExecutable="PowerToys.exe"as a placeholder — Copyas UNC has no UI executable. Is this the correct value, or should it differ?
GpoRuleConfigured.Unavailable. Happy toadd a proper
gpo.h+GPOWrapperentry if the team points to the rightpattern.
it to run, should be removed, guidance required.
design guidelines.
this is, maybe it would be better at the top, suggestions welcome.
Validation Steps Performed
Z:\folder\file.txt) inWindows 11 File Explorer.
icon.
(e.g.
\\server\share\folder\file.txt).DRIVE_REMOTE).CopyAsUNCContextMenuis included in the sparse package uninstallcleanup list in
CustomAction.cpp.