Reputation: 2637
Powershell n00b here. I want to mount an iso using PowerShell. I successfully did it like this:
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 :
But now I want to do one that has parentheses in the filename, like this:
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
How do I escape the parentheses? Backticks don't seem to work, nor does quoting the path with single or double quotes.
Upvotes: 1
Views: 1546
Reputation: 15478
Escape the parentheses:
Mount-DiskImage "C:\Program Files `(x86`)\Common Files\SLI_3.0.0_A00 `(1`).iso"
Backtick (`) is the escape character in PowerShell.
Upvotes: 1
Reputation: 8868
Single quotes make it a string literal and should work fine. Why are you calling powershell while in the powershell prompt? Perhaps that is the issue.
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 :
Upvotes: 1