New-Item cmdlet fails to create folder on PowerShell 7.0.0-preview.2
See original GitHub issueSteps to reproduce
- Create Ubuntu 18.04 VM in Azure
- wget https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-preview.2/powershell-preview_7.0.0-preview.2-1.ubuntu.18.04_amd64.deb
- sudo apt install ./powershell-preview_7.0.0-preview.2-1.ubuntu.18.04_amd64.deb
- pwsh-preview
- new-item -ItemType Directory ./newfolder
In bash run
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
pwsh
Then, run
New-Item -ItemType Directory ./bas
Expected behavior
new folder is created.
Actual behavior
PS /home/amitsaraf> new-item -ItemType Directory ./newfolder new-item : The type is not a known type for the file system. Only “file”,“directory” or “symboliclink” can be specified. At line:1 char:1
- new-item -ItemType Directory ./newfolder
-
- CategoryInfo : InvalidArgument: (😃 [New-Item], PSArgumentException
- FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.NewItemCommand
Environment data
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Using new-item to create folder occasionally throws error in ...
I have a powershell script which creates folders in an order, the same code creates the first folder, but throws error for the...
Read more >New-Item (Microsoft.PowerShell.Management)
The New-Item cmdlet creates a new item and sets its value. The types of items that can be created depend on the location...
Read more >Unable to create folders in current path with New-Item and ...
I am trying to use the New-Item -ItemType Directory in order make a folder, in the directory the script is located, and move...
Read more >PowerShell can't create folder on network mount
The first command works fine (assuming you have a c$ share enabled and are able to access it), and the second command gives...
Read more >How to Create Files and Folders with PowerShell
Let's dive in and look at how to create files and folders using the New-item, Add-Content, and Test-Path cmdlets. Advertisement. How to create...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The problem reproduces when the LANG is set as
C.UTF-8
. To workaround:🎉This issue was addressed in #10186, which has now been successfully released as
v7.0.0-preview.3
.🎉Handy links: