Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke-BatchFile throws "The input line is too long. The syntax of the command is incorrect." with latest VsDevCmd.bat #66

adamskt opened this issue Aug 6, 2019 · 0 comments


Copy link

commented Aug 6, 2019

Repro steps:

PS> Invoke-BatchFile "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"

Expected Result:

The batch file runs without error and loads VS stuff into session

Actual Result:

cmd.exe : The input line is too long.
At C:\Program Files\PowerShell\Modules\Pscx\3.3.2\Modules\Utility\Pscx.Utility.psm1:753 char:5
+     cmd.exe /c " `"$Path`" $Parameters && set " > $tempFile
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (The input line is too long.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
The syntax of the command is incorrect.
** Visual Studio 2019 Developer Command Prompt v16.2.1
** Copyright (c) 2019 Microsoft Corporation

I'm not sure what changed in VS Developer Command Prompt batch file, but it has made PSCX unhappy :( That being said, things like MSBuild and such do appear to be added to the path in-session, and it displays the banner, so it's not a blocking issue.


It appears the VS team has implemented their own PS module to do the things they were doing in the batch file. The same can be accomplished with the following commands:

Import-Module -Name "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevshell\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -InstanceId ba5a33e2

NB: That hex value passed to -InstanceId is not familiar to me, I grabbed it from the the startup parameters of the "Developer PowerShell for VS 2019" shortcut. Also, YMMV if you installed VS into a different path or have a different edition.


Visual Studio 2019 Enterprise version 16.2.0 or 16.2.1
Visual Studio 2017 Enterprise version 15.9.14

PSCX Version: 3.3.2
Cmdlet: Invoke-BatchFile
PSVersion: 5.1.18362.10000
PSEdition: Desktop
BuildVersion: 10.0.18362.10000
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.