To run a script in that manner try
& tells Powershell to execute the string rather than just echoing it
back. if you need parameters etc put them oustide the quotes
your command is
Please note that all scripts are supplied "as is" and with no warranty
PowerShell User Group: http://www.get-psuguk.org.uk
> I installed PowerShell to automate some tasks. I only write scripts and
> stumled upon the following "feature": When a script is located in a directory
> that has spaces in it I can't get PowerShell to execute the script. It always
> stops parsing after the first space character.
> Example: A script named "task.ps1" is located in "E:\All Batch Scripts\".
> If I open a Windows explorer and double-click on the file. It doesn't work.
> If I open a PowerShell and enter "E:\All Batch Scripts\task" it doesn't work
> and shows the following message:
> The expression "E:\All" was not recognized as a cmdlet, function, executable
> program or script file. Check the expression and try again.
> At Line:1 Character:7
> + E:\All <<<< Batch Scripts\task
> If I put the script path into double or single quotes PowerShell just echoes
> I can get it to work by putting the path parts that contain spaces in single
> quotes but that is not a general way to handle path names that contain spaces.
> So my question is: What do I have to do so that PowerShell executes scripts
> which have a path that contains spaces?
> And the second question is how to put that in a link file in the autostart
> directory so that the script is started whenever the user logs on?
> Any help would be greatly appreciated.