S-P-A-C-E-D, spaced out

For the first time in my programming career i discovered a language which can have whitespace in identifier names.

Guess which language it is?

Hint: I learned it – or so i thought – long before Pascal, C and Perl, but a bit after GW-BASIC.

It’s the MS-DOS batch file language.

In all the languages i know, variable assignment operator is = or something similar (it’s := in Pascal). Any number of spaces are allowed before and after it; Curiously, in Microsoft’s own QBasic it is encouraged and even automatically inserted if you try to write something like A=42.

But in DOS batch files, if you write this:

SET A = 42
ECHO %A%

You’ll get nothing.

But this will work:

SET A = 42
ECHO %A %

And guess what, it will print ‘ 42‘, with a space in the beginning.

Wow, wow, wow, wow, unbelievable.

2 Responses to “S-P-A-C-E-D, spaced out”


  1. 1 Alon 2007-06-13 at 12:52

    Where the hell in 2007 did you meet an MS-DOS shell???

    Thank god they got it straight in all versions of WSH…

  2. 2 aharoni 2007-06-13 at 15:53

    I wrote a custom post-build action for a Visual Studio project. It needs to run a few commands and copy some files when certain conditions are met after compilation.

    If i would to it for myself, i’d write it in Perl, of course, but i had to distribute it to programmers who don’t have Perl installed.

    (This last sentence should be an oxymoron, but unfortunately it is not…)

    I never studied WSH properly. VB.NET is a pretty good language, but VBScript is a bloody mess in its own right. It is better than BAT, but i didn’t want to waste time on learning how to copy files with it …


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Archives


%d bloggers like this: