[Win] Create a B/Max command prompt

BlitzMax Forums/BlitzMax Programming/[Win] Create a B/Max command prompt

SystemError51(Posted 2012) [#1]
Basically I got tired of opening a command prompt for bmk, navigate to the BlitzMax location and then enter bin, just to have access to the compiler.

Here's a quick and dirty solution that will make life easier.

Open up your favorite text editor and put in these few lines:

[bbcode]@ECHO OFF

SET "PATH=C:\Path\To\Your\BlitzMax\bin\;%PATH%"

@goto end

:end[/bbcode]

(The 'C:\Path\To\Your' has to be replaced by your real installation path)

Save this as commandPrompt.bat in your BlitzMax folder.

Next, navigate to your BlitzMax folder with the Windows Explorer. Once there, create a new shortcut.

For the moment, point it to the .bat file you just created - and name it something useful - like "BlitzMax Command Prompt"

Open up the properties of the shortcut.

Where it says "Target:", you'll have to make minor modifications.

Insert this into the text field:

[bbcode]%comspec% /k ""C:\Path\To\Your\BlitzMax\commandShell.bat""[/bbcode]

(The 'C:\Path\To\Your' has to be replaced by your real installation path)

The double-quotes are very important - they are escape sequences.

Click "OK" on that, and do a double-click. Navigate somewhere else (anywhere).

Type "bmk" - it will work :)

Have fun

Last edited 2012


Htbaa(Posted 2012) [#2]
OR you add the path to bmk in the PATH environment variable permanently. Just access it through My Computer, Manage and search for the advanced properties. There you just add it to the PATH setting. No need to run a special bat file afterwards.


xlsior(Posted 2012) [#3]
No need to run a special bat file afterwards.


Note that you do need to reboot once after adding it before it will take effect.


Htbaa(Posted 2012) [#4]
That's not true for Windows Vista/7, you do need to fire up a new command line.


Muttley(Posted 2012) [#5]
You don't need to reboot for pre-Vista either. You just need to log off and back on again.


SystemError51(Posted 2012) [#6]
Let's just say I don't want to mess with the system variables (although I could have done so if I really wanted), and I like a shortcut with a "bmk-ready" command prompt better.


Yasha(Posted 2012) [#7]
Nice trick I got from D4NM4N:

- add C:\bin or some other location to your PATH, in the manner described by Htbaa

- dump simple .bat wrappers for anything you want to use from the command line in that folder, and forget about PATH from then on

Nice and Unixy. Also a good place to store very simple utilities that are only made up of one binary anyway, e.g. Tcl interpreter.


e.g.:

Tiny C Compiler (tcc.bat) - simplest example, just needs to run the actual program:
@"C:\Program Files\tcc\tcc" %*


Blitz3D (blitzcc.bat) - needs to set BLITZPATH first:
@set BLITZPATH=C:\Blitz3D
@"%BLITZPATH%\bin\blitzcc" %*


...etc.

Last edited 2012