# Before\_script scripting environment/language

**URL:** <https://travis-ci.community/t/before-script-scripting-environment-language/6152>\
**Category:** Windows\
**Created:** [November 26, 2019, 12:39pm UTC](https://travis-ci.community/t/before-script-scripting-environment-language/6152 "2019-11-26T12:39:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tboulis](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/tboulis/32/3806_2.png) [@tboulis](https://travis-ci.community/u/tboulis)\
**Post date:** [November 26, 2019, 12:39pm UTC](https://travis-ci.community/t/before-script-scripting-environment-language/6152/1 "2019-11-26T12:39:16Z")

</div>

Im running a before\_script to load all env variables into a .env file for each os. My script is this:

```auto
before_script:
  - cp public/.env.example public/.env
  - |
    if ["$TRAVIS_OS_NAME" == "windows"];
    then get-content public/.env | %{$_ -replace $_,"$($_)$(Get-Variable -Name $_.TrimEnd("="))"};
    else printenv > public/.env;
    fi

```

The problem is that the command for windows runs correctly on my local powershell but when the script runs on the windows vm on travis it exits with error codes:

```auto
/c/Users/travis/.travis/functions: line 110: get-content: command not found
/c/Users/travis/.travis/functions: command substitution: line 111: syntax error near unexpected token `('
/c/Users/travis/.travis/functions: command substitution: line 111: `Get-Variable -Name $_.TrimEnd("="))"}'

```

I’m not sure if the before\_script is running inside the vm(windows) or inside a host(bash?). It is not clear in the docs what scripting language is used in the before\_script, etc lifecycles. Could you please provide more information?

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [November 26, 2019, 1:12pm UTC](https://travis-ci.community/t/before-script-scripting-environment-language/6152/2 "2019-11-26T13:12:24Z")

</div>

Your script will run with git bash, as explained in

> **[Travis CI Documentation](https://docs.travis-ci.com/user/reference/windows#git-bash)**
>
> The Windows Build Environment

  
not Power Shell.

---

<div class="post-metadata">

**Author:** ![tboulis](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/tboulis/32/3806_2.png) [@tboulis](https://travis-ci.community/u/tboulis)\
**Post date:** [November 26, 2019, 1:56pm UTC](https://travis-ci.community/t/before-script-scripting-environment-language/6152/3 "2019-11-26T13:56:47Z")

</div>

Thanks, sorry for not seeing that!

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [November 26, 2019, 1:57pm UTC](https://travis-ci.community/t/before-script-scripting-environment-language/6152/4 "2019-11-26T13:57:40Z")

</div>

No worries!
