How can I run this powershell command, in an AV yml file?

Pure Krome's Avatar

Pure Krome

19 Oct, 2015 01:27 AM

Hi Feodor,

i've got the following PS command which works great:

on_success:
  - ps: '& ".\NuGet\NuGet Package and Publish.ps1" -Version $env:appveyor_build_version -NuGet "C:\Tools\NuGet\nuget.exe" -feedSource https://www.myget.org/F/openrealestate/api/v2 -apiKey $env:apiKey'

but notice how it's linking to a relative file? i'm hoping to link it to a file on the interwebs. how can I do .. basically.. this ...

on_success:
  - ps: 'iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/PureKrome/PushIt/master/NuGet%20Package%20and%20Publish.ps1'))" -Version $env:appveyor_build_version -NuGet "C:\Tools\NuGet\nuget.exe" -feedSource https://www.myget.org/F/openrealestate/api/v2 -apiKey $env:apiKey'

so it's like: run this command with these args .. but .. first, download the command using iex ....

is this possible?

  1. Support Staff 1 Posted by Feodor Fitsner on 19 Oct, 2015 04:32 AM

    Feodor Fitsner's Avatar

    I remember trying it once, but not sure if that's possible. I think you should download it first to a file then run it with parameters. Another way is passing data through local variables which will be available in the script like there in the second command: http://www.appveyor.com/docs/how-to/rdp-to-build-worker

  2. 2 Posted by Pure Krome on 19 Oct, 2015 04:42 AM

    Pure Krome's Avatar

    I'm totally happy to dl as a fail using DownloadFile command. Where does that goto? or is there a nice variable i can use to say: $rootFolderOfProject

  3. Support Staff 3 Posted by Feodor Fitsner on 19 Oct, 2015 04:46 AM

    Feodor Fitsner's Avatar

    It saves to the current directory.

  4. 4 Posted by Pure Krome on 19 Oct, 2015 04:55 AM

    Pure Krome's Avatar

    um, what's the current directory, though? is there a environment var i can use to reference this current dir?

    REFERENCE: http://www.appveyor.com/docs/how-to/download-file

  5. Support Staff 5 Posted by Feodor Fitsner on 19 Oct, 2015 05:00 AM

    Feodor Fitsner's Avatar

    You can just use ./your_script.ps1

  6. 6 Posted by Pure Krome on 19 Oct, 2015 06:12 AM

    Pure Krome's Avatar

    that didn't work. I ended up having to preprending the full path.

    like this...

    - ps: $destinationPath = $env:appveyor_build_folder + ".\file1.ps1"; (new-object net.webclient).DownloadFile('https://raw.githubusercontent.com/PureKrome/PushIt/master/NuGet%20Package%20and%20Publish.ps1', $destinationPath); & $destinationPath -Version $env:appveyor_build_version -NuGet "C:\Tools\NuGet\nuget.exe" -feedSource https://www.myget.org/F/openrealestate/api/v2 -apiKey $env:apiKey -source '.\NuGet\' -destination '.\NuGet\'

  7. Pure Krome closed this discussion on 19 Oct, 2015 09:02 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac