chhenning
chhenning

Reputation: 2077

Write a text file in Appveyor script

I have a problem when writing a simple text file with appveyor. Here is the simple script:

version: 1.0.{build}-{branch}

shallow_clone: true

environment:
  matrix:
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
      TOOLSET: msvc-14.1
      ARCH: x86_64

install:

build: off

test_script:
  - echo ^<Where are my symbols^> > hello.txt
  - more hello.txt

This leads to an error in the console:

Build started
Fetching repository commit (2be7d4b)...OK
Total: 274 bytes in 1 files
echo ^<Where are my symbols^> > hello.txt
Command exited with code 1      

I have tried the commands in on desktop but everything is working.

Upvotes: 0

Views: 170

Answers (1)

Ilya Finkelsheyn
Ilya Finkelsheyn

Reputation: 2881

This escape symbol will not work this way because internally we use call before your cmd when executing command from the custom PowerShell host.

Workarounds:

  • Use PowerShell

test_script: - ps: Set-Content -Value "<Where are my symbols>" -Path .\hello.txt - more hello.txt

  • Check-in .cmd file with your command which uses ^ escape symbol and run it.

Upvotes: 1

Related Questions