I want to initialize my Cygwin environment with a variable coming from a batch file
@set myvar=test
%BASH% --login -c "set"
REM hope to see myvar
So I want myvar with its value eventually be available in bash.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can have the batch file append your variable to your bash.bashrc file to create bash environmental variables, like so:
Then you access that croot variable like so
or
The path on my machine is
C:\cygwin\etc\bash.bashrc… yours may differ.Note that the variable won’t be available in running cygwin sessions, only new ones.