Question Details

No question body available.

Tags

.net windows createprocess process.start processstartinfo

Answers (2)

May 7, 2026 Score: 1 Rep: 110,125 Quality: Medium Completeness: 80%

How long depends on the value of ProcessStartInfo.UseShellExecute.

If true then the underlying API is ShellExecute and the limits of that API apply.

If false then the underlying API is CreateProcess which has different restrictions.

In particular, if using the appropriate style of file system path, then a 32,699 unicode character path (so ~64kB buffer) can be used for the filename. And then the second argument, the command line arguments, can be another 32,767 characters long.

TL;DR: depending on options the limits change because different APIs are used.

May 7, 2026 Score: 1 Rep: 80,718 Quality: Medium Completeness: 80%

According to Raymon Chen, one of the senior developers of Windows:

It depends on whom you ask.

The maximum command line length for the CreateProcess function is 32767 characters. This limitation comes from the UNICODESTRING structure. CreateProcess is the core function for creating processes, so if you are talking directly to Win32, then that’s the only limit you have to worry about.

But if you are reaching CreateProcess by some other means, then the path you travel through may have other limits. ... If you are using the ShellExecute/Ex function, then you become subject to the INTERNETMAXURLLENGTH (around 2048) command line length limit imposed by the ShellExecute/Ex functions.

UseShellExecute = true uses, as you might imagine, the ShellExecuteExW function. But in this case, anything over 2048 is truncated silently.

UseShellExecute = false uses CreateProcessWithLogonW, which is similar to CreateProcessW.