描述
无法删除OneDrive目录中的非空文件夹
再生产步骤
在OneDrive目录中启动PowerShell
PS C:\Users\MyUserName\OneDrive>
尝试使用删除项cmdlet删除该目录中的非空文件夹,例如:.\test\文件夹。
PS C:\Users\MyUserName\OneDrive> Remove-Item .\test\
预期结果
如果没有-Recurse参数,PowerShell应该返回确认消息,例如
Confirm
The item at C:\Users\MyUserName\OneDrive\test\ has children a
下面显示的简单脚本会在我的计算机上导致异常:
Import-Module WebAdministration
Get-ChildItem IIS:\Sites
结果:
powershell -NonInteractive .\test.ps1
Get-ChildItem : Could not load file or assembly 'Microsoft.PowerShell.Commands.Management' or one of its dependencies. The system cannot
find the file specified.
At C:\..
我收到了Get-ChildItem : *A parameter cannot be found that matches parameter name 'Directory'*错误信息,下面是使用的脚本,请帮助我找到问题?
脚本:
Function Clear-ReadOnlyFiles([string]$path)
{
"Clearing readonly attribute from files in $path"
New-Variable -Name read_only -Value 1 -Option readonly
Get-ChildIte