Reputation: 277
Is there a way to sync windows environment variables with Cygwin?
For example, in CMD echo %inetroot%
gives the path to a project build. Is it possible to transfer this env variable to Cygwin such that echo $inetroot
provides the same path?
Thanks!
Upvotes: 16
Views: 23621
Reputation: 1
If you are a beginner, do the following:
1)Create a dir . In this dir, create a file named qqq.cmd that contains :
set ZZZZZZ=123aBBC1111111111111
set zZZz=123aBBC
rem cd = current dir
set pathz=%cd%
rem set pathz=%pathz%;i:\mingw\bin;F:\1MY\0CMD
rem set pathz=%pathz%;i:\1gtk+-2.10.1\examples\text
set path=%pathz%;%path%
I:\CYG\bin\mintty.exe -i /Cygwin-Terminal.ico -
exit
goto
goto
goto
2)In this dir, create another file named ss that contains :
#ss
#in notepad++ : click Edit , choose EOL conversion , then choose unix for this file ss. (no extension).
ln -s /cygdrive/c /c
ln -s /cygdrive/n /n
ln -s /cygdrive/e /e
ln -s /cygdrive/f /f
ln -s /cygdrive/i /i
echo $PATH
echo $path"assss----------"
echo $ZZZZZZ
echo $zZZz
echo $ZZZZ--=====++++++
echo $zZZz
echo $PATHZ --------
echo $pathz --====
cd /c
echo --------Note current dir in ss. :
pwd
if false; then
# ... Code I want to skip here ...
fdsgfsdsgfs
dfsdgfdsgfds
fi
exit
exit
3)Create shortcut for qqq.cmd and move the short cut to any where.
4)Then execute qqq.cmd by double clicking the shortcut and now you have Cygwin. Type ss and check the output and note the current dir now!!
Upvotes: 0
Reputation: 21259
Use the env
program to so that ... or echo "$inetroot"
. I think the variable names are case-sensitive, though (in Bash and thus MinGW).
Those variables are all available in MinGW from Windows (user profile and global). Again, use env
to list them or for example env|grep -i inetroot
to find the properly capitalized version of the variable name.
Upvotes: 9