Reputation: 22699
I am a developer and I use several portable Development tools on Windows such as:
Often I change systems frequently as as such I copy these portable tools to different systems. My problems lies in setting environment variables. Everytime, I change a system , I have to update environment variable. Currently, I use following batch script to update the environment variables
setx PATH "D:\adt\sdk\platform-tools;d:\PortableJekyll\x86\ruby\bin;d:\PortableJekyll\x86\git\bin;d:\PortableJekyll\x86\python\bin;d:\PortableJekyll\x86\devkit\bin;d:\PortableJekyll\x86\devkit\mingw\bin;F:\Common Tools\gnuwin32\bin"
However, this requires changing drive letters and folders depending upon target system. As a programmer, I would like to automate this one time job of setting up environment variables.
Any tips out there to make it even more automated like detecting certain EXE's and setting them up to be in PATH automatically.
Upvotes: 0
Views: 592
Reputation: 6642
I use linux, but the following can be easily translated to Windows:
I have a bunch of script in a Dropbox folder (in order to have them synchronized), and then, I just check for the machine name in order to setup environment variables.
As an example, take a look to my setup of the PS1
variable:
case $HOSTNAME in
wilderkrieger)
PS1='\[\e[3;33m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\W\[\e[1;32m\]`__git_ps1`\[\e[0m\]\$ ';
;;
notparallel)
PS1='\[\e[3;33m\]\u\[\e[3;36m\]@\[\e[3;33m\]\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[1;32m\]`__git_ps1 " (%s)"`\[\e[0m\]\n\$ '
;;
*)
PS1='\[\e[0;31m\]\u\[\e[0m\]@\[\e[1;31m\]\h\[\e[0m\]:\[\e[1;34m\]\W\[\e[1;32m\]`__git_ps1`\[\e[0m\]\$ '
;;
esac
I invoke those scripts from the .bachrc
file so they run automatically on each login, you could create a link from your home folder with mklink
and the just invoke the command each time you start a console.
Upvotes: 1