# Ruby & activeTcl run solely from a usb flash drive

**URL:** <https://www.ruby-forum.com/t/ruby-activetcl-run-solely-from-a-usb-flash-drive/73329>\
**Category:** Ruby\
**Created:** [October 23, 2006, 8:37pm UTC](https://www.ruby-forum.com/t/ruby-activetcl-run-solely-from-a-usb-flash-drive/73329 "2006-10-23T20:37:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leafhopper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/49beb7/32.png) [@leafhopper](https://www.ruby-forum.com/u/leafhopper)\
**Post date:** [October 23, 2006, 8:37pm UTC](https://www.ruby-forum.com/t/ruby-activetcl-run-solely-from-a-usb-flash-drive/73329/1 "2006-10-23T20:37:52Z")

</div>

All,

My goal is to run a ruby (gui/tk) from a usb flash drive.  
I have ruby (for windows) and Active Tcl installed on a usb flash drive.  
I would like to plug this into a windows os machine and not disrupt the  
windows os machine by making any changes to environment settings, and be  
able to run a ruby program using Active Tcl library for the gui. I have  
been able to run a ruby program (without gui) like this, but have not  
been able to make the Active Tcl library available for the gui.

When I use this line from a bat file located on the usb flash drive:  
\ruby\bin\ruby.exe -I \tcl\bin -I \ruby\bin -I \tcl\lib -rlibrary  
\tcl\lib\tcl8.4 -rlibrary \tcl\lib\tk8.4 test.rb

The error I get is:  
\ruby\bin\ruby.exe: Permission denied – /tcl/lib/tcl8.4 (LoadError)

Is there a way to get the Active Tcl libraries available to the usb ruby  
without making any os environment changes?

Thanks, Sari

---

<div class="post-metadata">

**Author:** ![leafhopper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/49beb7/32.png) [@leafhopper](https://www.ruby-forum.com/u/leafhopper)\
**Post date:** [October 24, 2006, 11:03pm UTC](https://www.ruby-forum.com/t/ruby-activetcl-run-solely-from-a-usb-flash-drive/73329/2 "2006-10-24T23:03:58Z")

</div>

Sari C. wrote:

> All,
> 
> My goal is to run a ruby (gui/tk) from a usb flash drive.  
> I have ruby (for windows) and Active Tcl installed on a usb flash drive.  
> I would like to plug this into a windows os machine and not disrupt the  
> windows os machine by making any changes to environment settings, and be  
> able to run a ruby program using Active Tcl library for the gui. I have  
> been able to run a ruby program (without gui) like this, but have not  
> been able to make the Active Tcl library available for the gui.
> 
> When I use this line from a bat file located on the usb flash drive:  
> \ruby\bin\ruby.exe -I \tcl\bin -I \ruby\bin -I \tcl\lib -rlibrary  
> \tcl\lib\tcl8.4 -rlibrary \tcl\lib\tk8.4 test.rb
> 
> The error I get is:  
> \ruby\bin\ruby.exe: Permission denied – /tcl/lib/tcl8.4 (LoadError)
> 
> Is there a way to get the Active Tcl libraries available to the usb ruby  
> without making any os environment changes?
> 
> Thanks, Sari

I built tcl/tk manually (ActiveTCL has distribution restrictions), built  
ruby manually and stuck them all in the same directory (containing bin,  
lib, etc). I then used this batch script to start ruby:

SET PATH=%CD%;%CD%\bin;%PATH%  
ruby main.rb

This way, I’m insulated from other ruby/tk installs on the system and I  
don’t affect any existing installs on the system (the path change is  
purely local). I haven’t tested this from a USB drive, but it works for  
a zipfile unzipped to a random place on a windows machine and run as a  
restricted user.

Andrew

---

<div class="post-metadata">

**Author:** ![leafhopper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/49beb7/32.png) [@leafhopper](https://www.ruby-forum.com/u/leafhopper)\
**Post date:** [October 24, 2006, 2:25am UTC](https://www.ruby-forum.com/t/ruby-activetcl-run-solely-from-a-usb-flash-drive/73329/3 "2006-10-24T02:25:43Z")

</div>

From: Sari C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: ruby & activeTcl run solely from a usb flash drive  
Date: Tue, 24 Oct 2006 03:37:54 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> My goal is to run a ruby (gui/tk) from a usb flash drive.

When I created a CD-R for running Ruby (One-Click Ruby) + ActiveTcl  
on the CD-R, I used the following batch file to initialize environment  
of a command-prompt.

------\<rubytk-setup.bat\>---------------------------------  
@echo off

rem \*\*\* initialize \*\*\*  
set ENVROOT=%~dp0  
set RUBYVER=182  
set TCLVER=8.4

:arg\_check  
if “%1”==“” goto setup

if not “%1”==“8.5” goto check\_85  
set TCLVER=8.5  
shift  
goto arg\_check

:check\_85  
if not “%1”==“85” goto check\_8.4  
set TCLVER=8.5  
shift  
goto arg\_check

:check\_8.4  
if not “%1”==“8.4” goto check\_84  
set TCLVER=8.4  
shift  
goto arg\_check

:check\_84  
if not “%1”==“84” goto check\_root  
set TCLVER=8.4  
shift  
goto arg\_check

:check\_root  
set ENVROOT=%~f1  
shift  
goto arg\_check

:setup  
echo env\_root is %ENVROOT%  
echo add %ENVROOT%ruby%RUBYVER%\bin and %ENVROOT%ActiveTcl%TCLVER%\bin  
to PATH  
set  
PATH=%ENVROOT%ruby%RUBYVER%\bin;%ENVROOT%ActiveTcl%TCLVER%\bin;%PATH%  
set RUBYBINPATH=%ENVROOT%ruby%RUBYVER%\bin

rem set RUBYOPT=rubygems

## set ENVROOT= set RUBYVER= set TCLVER=

## On the CD-R, extracted Ruby and ActiveTcl files were placed like as the next.

./Windows/rubytk-setup.bat

./Windows/ActiveTcl8.4:  
MANIFEST README.txt bin/ demos/ doc/ include/ lib/  
license.terms

./Windows/ActiveTcl8.5:  
MANIFEST README.txt bin/ demos/ doc/ include/ lib/  
license.terms

./Windows/ruby182:  
ProgrammingRuby.chm doc/ installer/ readme.txt share/  
ReleaseNotes.txt freeride/ lib/ samples/ uninst.exe  
bin/ include/ man/ scite/
