Skip to content

Bad error message thrown when creating a symbolic link #3700

@daxian-dbw

Description

@daxian-dbw

Steps to reproduce

## I intend to create a symbolic link `foo` pointing to the directory 'bar'.
## However, I incorrectly specified the target directory path as the argument to `-Path`.
mkdir F:\temp\bar
New-Item -ItemType SymbolicLink -Path F:\temp\bar -Value F:\temp\foo

Expected behavior

Error message should be meaningful and useful

Actual behavior

PS:62> New-Item -ItemType SymbolicLink -Path F:\temp\bar -Value F:\temp\foo
New-Item : NewItemIOError
At line:1 char:1
+ New-Item -ItemType SymbolicLink -Path F:\temp\bar -Value F:\temp\foo
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceExists: (F:\temp\bar:String) [New-Item], IOException
    + FullyQualifiedErrorId : NewItemIOError,Microsoft.PowerShell.Commands.NewItemCommand

Environment data

> $PSVersionTable
Name                           Value                                                               
----                           -----                                                               
PSVersion                      6.0.0-alpha                                                         
PSEdition                      Core                                                                
BuildVersion                   3.0.0.0                                                             
CLRVersion                                                                                         
GitCommitId                    v6.0.0-alpha.18-54-g3e416fb6422c0c25f63bd0228edd2403ae2c78d4        
OS                             Linux 4.8.0-41-generic #44~16.04.1-Ubuntu SMP Fri Mar 3 17:11:16 ...
Platform                       Unix                                                                
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                             
PSRemotingProtocolVersion      2.3                                                                 
SerializationVersion           1.1.0.1                                                             
WSManStackVersion              3.0              

Metadata

Metadata

Assignees

Labels

Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management module

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions