SharpeRAD / Cake.Powershell

Powershell addin for Cake
http://cakebuild.net
MIT License
83 stars 36 forks source link

Running Script Files with Spaces in Path Fails to Run #36

Closed tcables closed 6 years ago

tcables commented 6 years ago

Hi, thanks for making such a useful addon for Cake!

If I pass a file path into StartPowershellScript that contains a space character, eg M:\@Git-Workspaces\Dev Scripts\registerPSRepository.ps1 I will get the following error:

StartPowershellScript: install PS repo...
Executing: M:\@Git-Workspaces\Dev Scripts\registerPSRepository.ps1 -moduleName ODBC -feedName Solutions-PS -feedURL 'http://xxxxxxx/nuget/Solutions-PS' -Verbose
M:\@Git-Workspaces\Dev : The term 'M:\@Git-Workspaces\Dev' 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:1
+ M:\@Git-Workspaces\Dev Scripts\registerPSRepository.ps1 -moduleName O ...
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (M:\@Git-Workspaces\Dev:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Finished executing task: ensure-psrepo

cake code:

Verbose("StartPowershellScript: install PS repo...");
StartPowershellScript(@"M:\@Git-Workspaces\Dev Scripts\registerPSRepository.ps1", 
    new PowershellSettings()
    {
        FormatOutput = true,
        LogOutput = true
    }.WithArguments(args =>
    {
        args.Append("moduleName", "ODBC");
        args.Append("feedName", "Solutions-PS");
        args.Append("feedURL", "'" + publishNugetFeed + "'");
        args.Append("-Verbose");
    }));
tcables commented 6 years ago

oops should have called StartPowershellFile, now I feed dumb.