Setting path variable in windows os


#1

Hi,
I’m trying to set windows os environment variable as:
(* in the before_install part>>)

  • powershell “Env:path += ;C:\Users\travis\build\AviramNahon\oxygen-ide\WiX.Toolset.3.9.1208.0\tools\wix”

it doesn’t seem to work, I get “The term ‘Env:path’ is not recognized”
can you please advise me how to do it? guess I miss something here.

this the link to the build: https://travis-ci.com/AviramNahon/oxygen-ide/jobs/163867060
this is the response:
$ powershell “Env:path += ;C:\Users\travis\build\AviramNahon\oxygen-ide\WiX.Toolset.3.9.1208.0\tools\wix”
The command “powershell “Env:path += ;C:\Usersraviuild\AviramNahon\oxygen-ide\WiX.Toolset.3.9.1208.0ools\wix”” failed and exited with 1 during .
Your build has been stopped.
Env:path : The term ‘Env:path’ 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

  • Env:path += ;C:\Users\travis\build\AviramNahon\oxygen-ide\WiX.Toolset …
  • CategoryInfo : ObjectNotFound: (Env:path:String) , CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException

C:\Users\travis\build\AviramNahon\oxygen-ide\WiX.Toolset.3.9.1208.0\tools\wix : The term
‘C:\Users\travis\build\AviramNahon\oxygen-ide\WiX.Toolset.3.9.1208.0\tools\wix’ 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:14

  • … nv:path += ;C:\Users\travis\build\AviramNahon\oxygen-ide\WiX.Toolset. …
  • CategoryInfo : ObjectNotFound: (C:\Users\travis…208.0\tools\wix:String) , CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException

#2

well, I did manage to pull it out by:
export PATH=$PATH:";C:\Users\travis\build\AviramNahon\oxygen-ide\WiX.Toolset.3.9.1208.0\tools\wix" instead.
still I don’t understand why the “ENV:path” way doesn’t work.


#3

Your code is not correct Powershell. See e.g. https://stackoverflow.com/questions/714877/setting-windows-powershell-path-variable .

Also note that Travis executes the script with Git Bash which will process the command line according to Bash rules before passing it to the program.


#4

Not sure what you mean.
In the link you gave it’s similar to what I did:
env:Path += “;C:\Program Files\GnuWin32\bin”
also other PS commands do work very well.

anyway, export PATH=$PATH:";C:\Users\travis\build…" works for me (can be verified by other PS command:
powershell “(Get-ChildItem env:path).Value”)


#5

I’m having trouble figuring out how to add to the PATH environment variable after installing Strawberry Perl. I tried:

set "PATH=C:\\Strawberry\\perl\\bin;%PATH%"

But I can’t tell if it worked, because echo %PATH% emits the literal string %PATH%, not the contents of the environment variable. So I tried:

export "PATH=/c/Strawberry/perl/bin:$PATH"

And that appears to work when I echo $PATH, but when I run perl -v, it appears to find c:\Perl\bin, not C:\Strawberry\perl\bin.

I don’t believe I’m using PowerShell, because I don’t run powershell. So what environment is this, exactly, and how do I convince the shell to add a directory to the path?


#6

Okay, The export variant does actually work. Glad to have that figured out. See this example as I try to work things out. Now trying to get cpanm to execute. It hangs. :frowning: