Portable MinGW on USB Thumb Drive
I always have a thing for portable software, because well, they are portable! That feeling when you know everything you need is on a thumb drive is really incredible. Also, I'm a really hardworking person and I like using the time on MTR to code, so sometimes I would carry my project files around in a thumb drive to work. On the other hand, installing software on my computer in the office is really annoying. We have to submit a form (which has our manager's signature on it) to the Software Group to install anything which needs administrator rights. And the people in the Software Group work in a fuckin' slow pace and also, they are fuckin' retarded and of no use. Consequently, I have a 16Gb thumb drive which has software like OpenOffice, MikTex, Chrome (my company uses Internet Explorer, damn...) for my daily work. I even have a portable Python on it too.
Save the batch file.
5. Double click the batch file to run.
Lately, I've been trying to work on some open-source projects and so I thought it would be cool to have a compiler to test code wherever I want. So I try to make MinGW portable and have it on my thumb drive. Turns out it's not that hard and here are the steps.
1, Install MinGW on a computer, duh...
2. Copy the whole "mingw" folder to the thumb drive
3. Create a batch file (.bat) in the path "\mingw\bin" (on the thumb drive)
4. In the .bat file, write "path=%path%;%CD%" and save.
5. Open up a command prompt and navigate to the batch file and run.
If you think step 5 is a bit annoying, then here's an alternative step 4 and 5 proposed from this link:
4. Inside the batch file, write the following:
@echo off
path=%path%;%CD%
title MinGW Compiler
echo Ready to compile!
cmd.exe /K
Save the batch file.
5. Double click the batch file to run.
6. Compile code like what you usually do, for example,
g++ helloworld.cpp -o helloworld.exe
7. High five, bro!
Kev
Portable MinGW on USB Thumb Drive
Reviewed by Kevin Lai
on
8:36:00 AM
Rating:
Thank you! =D
ReplyDelete%CD% returns the path to the caller of the batch file, not the batch file itself. If for some reason the file or a slightly edited one is called from a different location than \bin this will fail. Instead of %CD% one should use %~dp0 which returns the path to the location of the bat file.
ReplyDeletepath=%path%;%~dp0