这里是Powershell n00b。我想使用PowerShell挂载一个iso。我成功地做到了这样:
PS C:\> PowerShell Mount-DiskImage C:\3D_Ultra_Pinball_Thrillride\pinball-disc.iso
Attached : True
BlockSize : 0
DevicePath : \\.\CDROM2
FileSize : 214403072
ImagePath : C:\3D_Ultra_Pinball_Thrillride\pinball-disc.iso
LogicalSectorSize : 2048
Number : 2
Size : 214403072
StorageType : 1
PSComputerName :但是现在我想做一个在文件名中有括号的操作,如下所示:
PS C:\> PowerShell Mount-DiskImage "C:\Program Files (x86)\Warcraft III\warcraft-disc.iso"
x86 : The term 'x86' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:35
+ Mount-DiskImage C:\Program Files (x86)\Warcraft III\warcraft-disc.iso
+ ~~~
+ CategoryInfo : ObjectNotFound: (x86:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException如何避免括号?Backticks似乎不工作,也不引用单引号或双引号的路径。
发布于 2020-08-02 05:06:50
单引号使它成为字符串文字,应该可以正常工作。为什么在powershell提示符中调用powershell?也许这就是问题所在。
PS C:\> Mount-DiskImage 'C:\Program Files (x86)\Common Files\SLI_3.0.0_A00 (1).iso'
Attached : True
BlockSize : 0
DevicePath : \\.\CDROM1
FileSize : 1882193920
ImagePath : C:\Program Files (x86)\Common Files\SLI_3.0.0_A00 (1).iso
LogicalSectorSize : 2048
Number : 1
Size : 1882193920
StorageType : 1
PSComputerName :发布于 2020-08-02 08:11:45
转义括号:
Mount-DiskImage "C:\Program Files `(x86`)\Common Files\SLI_3.0.0_A00 `(1`).iso"回拨(`)是PowerShell中的转义字符。
https://stackoverflow.com/questions/63212469
复制相似问题