Skip to content

Instantly share code, notes, and snippets.

@mattroyer
Created May 26, 2012 18:32
Show Gist options
  • Save mattroyer/2794873 to your computer and use it in GitHub Desktop.
Save mattroyer/2794873 to your computer and use it in GitHub Desktop.
Portable Development Environment Using Dropbox and Windows

#Portable Development Environment Using Dropbox and Windows I get annoyed when moving to a new Windows system. I'm an OS X user at heart, but have a laptop, a netbook, and a workstation at my job that all use the Windows operating system. To combat the pain of setting up a development environment and not having my OS X terminal commands at hand, I have created a way to get my development environment up and running by downloading Dropbox on the new Windows machine and running a .reg file.

That's all. No fuss. Download Dropbox (I put it in the root C: directory for easy use), run the .reg, and I'm off and running with all my code projects, git, ruby, gvim, and even Sublime Text 2.

To achieve command line aliases, like I have on my OS X machine, I use the Windows Doskey command. It comes with Windows. I have successfully used it in both Windows XP and Windows 7.

My Dropbox folder is setup with the following structure:

C:\Dropbox\

      \Apps
      \Apps\DevKit\          # This allows Ruby to use the C bindings in certain gems
      \Apps\git
      \Apps\ruby
      \Apps\SublimeText2
      \Apps\tmp\
               \macinit
               \Mine.reg
               \myRun.bat
               \pik\         # This is a Windows Ruby version manager
      \Apps\vim
      \Development

The tmp directory is where all the magic happens. The .reg file holds an entry that says to run myRun.bat every time a new command prompt window is opened.

alias=doskey /macros
dkey=vim C:\Dropbox\Apps\tmp\macinit
toDesk=cd %USERPROFILE%\Desktop$tcd
toClass=cd C:\Dropbox\Development\Projects\Classroom$tcd
toAuthor=cd C:\Dropbox\Development\Projects\AuthorSite$tcd
toWrite=cd C:\Dropbox\Writing$tcd
toDev=cd C:\Dropbox\Development$tcd
toBtr=cd C:\Dropbox\Development\Projects\BTR$tcd
toSinatra=cd C:\Dropbox\Development\Languages\Ruby\SinatraApps$tcd
toLang=cd C:\Dropbox\Development\Languages$tcd
toHub=cd C:\Dropbox\Development\Projects\GitHub$tcd
toSlop=cd C:\Dropbox\Development\Projects\Sloppy$tcd
toQuick=cd C:\Dropbox\Development\Projects\QuickTests$tcd
toNerd=cd C:\Dropbox\Development\Projects\NerdNight$tcd
mc=md $1$tcd $1$tcd
rd=rmdir /s /q $1
l=dir
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"Autorun"="C:\\Dropbox\\Apps\\tmp\\myRun.bat"
@echo off
prompt $n:$g
doskey /macrofile=C:\Dropbox\Apps\tmp\macinit
path C:\Dropbox\Apps\tmp\pik;C:\Dropbox\Apps\vim;C:\Dropbox\Apps\git\cmd;C:\Dropbox\Apps\ruby\bin;C:\Dropbox\Apps\SublimeText2;%PATH%
set GEM_PATH=C:\Dropbox\Apps\ruby\lib\ruby\gems\1.8
@ryancastro
Copy link

You should update myRun.bat as follows:
doskey /macrofile=%~dp0macinit

%~dp0 makes the file load dynamic, so as long as the alias file is sitting next to the batch file, you won't need to have an explicit path. It's a little more flexible for people like me who don't intend on using dropbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment