Enable batchfiles to run via CreateProcessW - #30490
Open
ahewitson-ops wants to merge 4 commits into
Open
Conversation
ahewitson-ops
marked this pull request as ready for review
July 28, 2026 14:29
Author
|
As Marc pointed out in the Windows channel, in theory this could be working but slow because windows first tries to run it as a PE binary and then silently rewrites to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Enables Batchfiles to be ran via CreateProcessW even when their paths exceed
MAX_PATH.Adds a Manifest for long path awareness to
tw.exeandxml.exe.Looks to fix #30431
Motivation
#29921 helped us Windows users by enabling long paths for all .exe files, but specifically left out Batch/cmd files. Specifically because
.batand.cmdfiles must be run through an interpreter likecmd.exe, as stated in the CreateProcessW documentation.However, testing shows that CreateProcessW can in fact handle being given a .bat or .cmd file above long paths, and silently rewrites the call to shunt it over to
cmd.exewithout the user having to do anything. The only caveat is thatcmd.exedoes not understand the\\?\prefix for long paths and so a .bat/.cmd path must be passed without it.I want to also note the manifest changes came from @nwatkiss in another PR for handling long paths HERE.
Build API Changes
No
Checklist
Release Notes
RELNOTES: Enable Batchfiles to also be ran when their paths exceed MAX_PATH.