401

professional dilettante

.bat Script for Setting Windows Path Environment Variables

I had an install of ruby from source on my USB WD Passport drive. Using the ruby install on my portable drive on multiple windows machines requires updating the Path environment variable to reflect the USB drive letter assigned by that particular machine to my drive. The drive letter could be different each time, depending [...]

I had an install of ruby from source on my USB WD Passport drive. Using the ruby install on my portable drive on multiple windows machines requires updating the Path environment variable to reflect the USB drive letter assigned by that particular machine to my drive. The drive letter could be different each time, depending on the machine and the USB port. So I had a crack at writing a .bat file that I can run instead of clicking around and typing the path and drive letter to the ruby /bin directory, I  can run this .bat file and it will set the Path for me. It does not seem to stay in the system, which I suppose you would not want it to since the drive letter may be different each time. But I run it from the windows command prompt and then I have ruby available for that shell.

@ECHO OFF
set d = %~d0
ECHO %PATH% | FIND /I "%d%:\lib\ruby\ruby191\bin"
IF ERRORLEVEL 1 SET PATH=%PATH%;%~d0\lib\ruby\ruby191\bin

Leave a Reply

Required fields are marked with an asterisk (*), you may use these tags in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 

Spam protection by WP Captcha-Free

Most Recent Post

create a file from content on your clipboard

You’re on github or something, reading code. You need to add some code to your project. You could: curl or wget the file URL clone the repo, extract single file, move it on file system create the file, open an editor, and paste in the content save as Here’s a terminal command I like. From [...]

Categories

Content © professional dilettante
Proudly powered by WordPress
Theme designed by Artisan Themes

Entries (RSS)
Comments (RSS)

25 queries.
0.741 seconds.