Combined length of 8191 characters, maybe. Or maybe it depends on the program you're running.
Source: Trial and error (Windows 8.1 / PSv4):
Start-Process -FilePath cmd -ArgumentList (@('/k','echo 1') + (2..1852))
# works
Start-Process -FilePath cmd -ArgumentList (@('/k','echo 1') + (2..1853))
# doesn't work
Around 6769 it triggers an exception:
PS C:\> Start-Process -FilePath cmd -ArgumentList (@('/k','echo 1') + (2..6768))
Start-Process : This command cannot be run due to the error: The filename or extension is too long.
At line:1 char:1
+ Start-Process -FilePath cmd -ArgumentList (@('/k','echo 1') + (2..676 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
But if I shift the numbers a bit (2..1852|%{$_*100})
then it fails sooner. Suggesting it's not the number of arguments which matters, but the string length of the combined result.
((@('/k','echo 1') + (2..1852)) -join " ").Length
# 8160 when it works, 8165 when it breaks
Google for 8165 limit cmd
and get:
Maximum Length of Command Line String
https://support.microsoft.com/en-gb/kb/830473
On computers running Microsoft Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters.
So, either 8191 characters or ... maybe it depends on the program you're calling.
300 * 32 would break that.
But then again, if you've already got a program which can handle it - start-process appears to have no problem with an array of 1,800 items as an argument list.