diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs index 2ac2938526..09128a9735 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/ParsePathCommand.cs @@ -553,9 +553,12 @@ namespace Microsoft.PowerShell.Commands if (SessionState.Path.IsPSAbsolute(path, out driveName)) { - // Remove the drive name and colon - - result = path.Substring(driveName.Length + 1); + var driveNameLength = driveName.Length; + if (path.Length > (driveNameLength + 1) && path[driveNameLength] == ':') + { + // Remove the drive name and colon + result = path.Substring(driveNameLength + 1); + } } }