Blog: Keogh Code - Starting from batch

Surprisingly, Google can't solve every problem.


Over the past couple of weeks, I've been extremely busy - on deadline, prepping for a trip to E3, and dealing with an injury - so truthfully I haven't had a lot of time to code. When I picked up again, I felt like I had to do a refresher. Rather than skim the chapters I'd read of the book I've been using, I picked up a new book and started from scratch there.

Much of it has become second nature to me, and was rather easy. However, there were a couple of new tricks I hadn't learned yet, like creating batch files.

Batch files, the way the book explained it, are files you create in Notepad with the extension .bat, and they alter the way the .exe file you've produced is run. For example, the batch file I created was designed to pause after the program ran, so it wouldn't flash up on the screen and disappear again.

The problem, I found, was that using a batch file had the weird result of writing out the full path of the .exe file, as shown in the screenshot below:



Confused, I turned to Google. For the first time in quite some time, however, my Google-fu failed to turn up any results. Seasoned programmers - is there any way to use a .bat file to pause an application without showing the full file location?

I suppose, given that I know a couple of different methods for pausing a program anyway, that learning about this particular batch file isn't important.

By now I've gotten far enough that I'm on the verge of creating my first game. I've learned all of the code I'll need - in theory, anyway. How well I've learned it will quickly become apparent once I start. All I need to do now is write something, with some assistance from a handy-dandy textbook and my loyal Assistant, who has been talking me through all the complicated concepts and dropping hints for me when my code won't compile.

Making a little game might seem like a small thing, but it's kind of a big deal to me - being able to create something that works, that someone else can use and might even like - it's exciting to me. Of course, I've been doing this all along, but a game seems more complex and more interesting than a calculator that can only solve one or two equations.

The game will be a text-based adventure game, so obviously nothing too complex - I'm not making AAA titles just yet - but when I'm done (and it could take a while), I'll upload it so you guys can give it a crack. For those who are interested, I'll also upload the code for the game, and I'll try to annotate it in a way that makes it vaguely understandable. So far, though, my note-taking skills have not been great.
2 Comments
Echo Put @echo off at the very beginning of the batch file.

"echo off" prevents the path from being displayed, and @ ensures the echo command itself isn't printed.
Posted by Alex at 13:38:45 on May 29, 2012

Flag abuse

Echo Awesome! Thank you, Alex!
Posted by Siobhan Keogh at 9:06:57 on May 30, 2012

Flag abuse

CURRENT ISSUE
Newsletter & Subscriptions Windows vs. iOS vs. Android:
How to choose the best tablet for you

101 great websites:
You haven't heard of yet

DIY desktops:
We ask the pros for building tips

SIGN UP
PC World's weekly round-up of tech news, gear and game reviews, software selections, and handy How Tos.
Blogs
Hot Products

Hot Products || PC World editors iPhone 4S launch pics and unboxing
The iPhone 4S launched at midnight through both Vodafone and Telecom. ... READ MORE

Tux Love

Tux Love || Geoff Palmer Google : Starting to be evil?
Google recently deleted AdBlock Plus from its Android Play Store. This is ... READ MORE

Tech Guy

Tech Guy || Juha Saarinen Small balls of solder
The idea that desktops might change forever is enough to send geeks into a ... READ MORE

In a Nutshell

In a Nutshell || Zara Baxter Logging, not login
At an event in Singapore yesterday, Seamus Byrne, the editor of CNet ... READ MORE

Harley O'Gyver

Harley O'Gyver || Harley Ogier Pay for internet by-device? Not on my watch.
So as those of you who follow my twitterstream will know, I'm currently in ... READ MORE

The Arcade

The Arcade || PC World editors New Year, new games
You'er going to laugh. Or at the very least, you're going to scoff and ... READ MORE

Dumb Terminal Live!

Dumb Terminal Live! || PC World editors New Zealand memes: We think we're real funny
We New Zealanders love the internet, and we have a pretty good sense of ... READ MORE