Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

quoted arguments containing spaces are split, how to prevent it?

$
0
0

Hi,

im trying to supply multiple filenames to a powershell script but they get split at the spaces even tho they are quoted.

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "X:\abc.ps1" "Y:\my dir\1.tmp" "Y:\your dir\2.tmp"

unfortunately i get 4 args:
Y:\my
dir\1.tmp
Y:\your
dir\2.tmp

i've searched and the only thing that worked was using single-quotes
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "X:\abc.ps1" 'Y:\my dir\1.tmp' 'Y:\your dir\2.tmp'

but it is another application that starts the powershell and it has the double-quotes around the filenames fixed so it will always be

.... "Y:\my dir\1.tmp" "Y:\your dir\2.tmp"

is there a way to make it work with these quotes?

Thanks


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>