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 - Fatal编程技术网

PowerShell删除项-字符串后的通配符?

PowerShell删除项-字符串后的通配符?,powershell,Powershell,对不起,这太基本了。我已经定义了一个字符串,它是一个没有扩展名的文件路径 $filepathwithoutextension 我想删除以该文件路径开头的所有文件(因此基本上所有具有相同名称(但不同扩展名)的文件都会被删除。我会使用通配符(*),如: 但是很明显,这种语法是错误的。我如何在PowerShell中成功地做到这一点呢?非常感谢!$filepathwithoutextension的值是多少??类似于“C:/Path/To/Filewithoutextension”的内容。您如何知道语法

对不起,这太基本了。我已经定义了一个字符串,它是一个没有扩展名的文件路径

$filepathwithoutextension
我想删除以该文件路径开头的所有文件(因此基本上所有具有相同名称(但不同扩展名)的文件都会被删除。我会使用通配符(*),如:


但是很明显,这种语法是错误的。我如何在PowerShell中成功地做到这一点呢?非常感谢!

$filepathwithoutextension的值是多少??类似于“C:/Path/To/Filewithoutextension”的内容。您如何知道语法是错误的?是否收到错误消息?使用引号
“$filepathwithoutextension.*”
。否则,Powershell将假定您正在尝试访问变量后面带有该点的属性。
Remove-Item $filepathwithoutextension.*