Mypath := "C:\temp\example1.txt"
Run, powershell -command "get-content -path %Mypath% | Set-Clipboard"
The above works just fine, content is copied to the clipboard by PowerShell but when I do the same thing but with a file that has a space in its file name it fails to run in PowerShell.
Running below
Mypath := "C:\temp\example 1.txt"
Run, powershell -command "get-content -path %Mypath% | Set-Clipboard"
I get this error in PowerShell
Get-Content : A positional parameter cannot be found that accepts argument '1.txt'.
I have also tried to use double quotes on each side and use Autohotkeys escape symbol like so:
Mypath = "`"C:\temp\example 1.txt`""
Run, powershell -command "get-content -path %Mypath% | Set-Clipboard"
As well as
Mypath = ""C:\temp\example 1.txt""
Run, powershell -command "get-content -path %Mypath% | Set-Clipboard"
But on both occasions, PowerShell throws this error;
The string is missing the terminator: ".
What am I doing wrong? any help would be appreciated.