Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 无法重命名,因为指定的目标表示路径或设备名称_Powershell_Recursion_Rename - Fatal编程技术网

Powershell 无法重命名,因为指定的目标表示路径或设备名称

Powershell 无法重命名,因为指定的目标表示路径或设备名称,powershell,recursion,rename,Powershell,Recursion,Rename,获取子项“C:\temp\test\testsub”-递归-包含*.wav |%{Rename Item$|-NewName($.Directory.Name.Substring(4)“+”($.Name.wav”)} 我不理解这个错误 [错误]无法重命名,因为指定的目标表示路径或设备名称。正如其他人所提到的,人们只能猜测您试图实现的目标,因此我的猜测如下 删除-如果要进行更改,请执行以下操作: Get-ChildItem 'C:\temp\test\testsub' -Recurse -Inc

获取子项“C:\temp\test\testsub”-递归-包含*.wav |%{Rename Item$|-NewName($.Directory.Name.Substring(4)“+”($.Name.wav”)}

我不理解这个错误


[错误]无法重命名,因为指定的目标表示路径或设备名称。

正如其他人所提到的,人们只能猜测您试图实现的目标,因此我的猜测如下

删除-如果要进行更改,请执行以下操作:

Get-ChildItem 'C:\temp\test\testsub' -Recurse -Include *.wav | % {rename-item $_.fullname $($_.directory.name.substring(0, 4) + '-' + $_.name) -whatif}

您想将其重命名为什么?请提供更多信息,例如原始文件名以及您希望将其重命名为什么。这是答案,尽管我还不明白为什么。尝试使用目录名的前四个字符重命名中包含的文件。多亏了斯特林格先生。