Click here to Skip to main content
13,056,229 members (74,021 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have a small block of code that is supposed to parse through a file called data.dta but for some reason it keeps saying ( unexpected, here is the code(I put a comment by the line that gives me an error):

cd %appdata%\.Trek
FOR /f "eol=#" %%t IN (Resources\Data\data.dta) DO ( ::problem line
	set count=1
	set cor=0
	FOR /f "tokens=1-2 delims=^=" %%f IN ("%%t") DO (
		If %count% == 1 (
			IF %%f==VERSION set cor=1
		If %count% == 2 (
			IF %cor%==1 (
				set cor=0
				set ver=%%f
		set /a count=%count%+1
Title TREK Unmounted Console Version: %ver%

Contents of data.dta:

Posted 28-Mar-13 11:57am
Updated 28-Mar-13 12:57pm
Sergey Alexandrovich Kryukov 28-Mar-13 18:01pm
Is there any specific reason to use such an outdated and weak tool as batch for the problem of this complexity? People used to solve much trickier problems, but who want to dig into such stuff?
Why not using, for example, PowerShell, with its powerful debugging features and huge expressive power?
Why not using "real" programming? (This is a developer's site, by the way :-)
Sicppy 28-Mar-13 18:40pm
I meant to make the a reply
Sicppy 28-Mar-13 18:30pm
Batch is 'real' coding, you put together a sequence of commands to make a functioning program, and i'm using batch for fun, its just a little project im doing, its not complicated, so no need to use a more complex language
Sergey Alexandrovich Kryukov 28-Mar-13 18:43pm
I do know how batch works and how to use it. It depends on what you call "real". Call it the way you want, it won't change the fact that you cannot use any effective debugging and development tools. So, I still cannot see why not using something else. By the way, I do understand the convenience of batch, I use it myself...
Sicppy 28-Mar-13 19:01pm
Yes, it is very convenient, but other than that, I really enjoy coding in batch, also, alot of the functions of this program are going to be in java/c++, the batch is just a host, if you would like to see the whole project I can send you the zip file
Sergey Alexandrovich Kryukov 28-Mar-13 19:05pm
If you enjoy it, which is very unusual (do you even enjoy the debugging? :-), you had much better chances to solve the problem by yourself the most people here, how typically hate it. :-)
Why not enjoying learning PowerShell? Since last version 3 (of 2012), it's a wonderful pleasing tool...
Sicppy 28-Mar-13 19:10pm
I can tell you right now, I absolutly hate debugging, although I do like what it does. Second of all, I like batch for a couple of reasons, It was the first programming language I learned(well that and qBasic), and also because so many people hate it
Sergey Alexandrovich Kryukov 28-Mar-13 19:14pm
Imagine that PowerShell debugging can be a real pleasure. (!) Well, Basic is just a bit more advanced the batch, nothing to discuss much... :-)
PIEBALDconsult 28-Mar-13 19:22pm
"what you call "real". "

It's Turing-complete.

"use any effective debugging"

That's a plus. When I was a kid we didn't _have_ debuggers. A proper dev should be able to function effectively without one.
Sergey Alexandrovich Kryukov 28-Mar-13 19:29pm
Is it? Good point anyway. Well, tell me about debugging... I was the one who even used the perforated cards, not seriously though...
Sicppy 28-Mar-13 19:30pm
THANK YOU! so many people assume these days that if it doesnt have a debugger its not a programming language. It's good to know that I'm not the only one with an accurate definition of Programming Language
Good point. At least three of us know what programming is. :-)
Sicppy 3-Apr-13 0:40am
Thank you for joining the party :-)
Sicppy 3-Apr-13 0:44am
Also, I would really appreciate it if you took a look at my first article post and give me some feedback, its about a developer resource I made to make programming with TCP Sockets easier

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Please see my comments to the question and still consider using PowerShell:[^],[^].

It is a really fully-fledged scripting tool and the language, with feature-rich and very interesting programming paradigm based on .NET (and exposing nearly all power of .NET to the script developer, among many other things like WMI and WSH, and more). Since its v.3 (of 2012), it also got such a powerful yet simplistic development IDE, that even the debugging became a real pleasure.

Just think about it.

Sicppy 28-Mar-13 19:26pm
I will learn powershell and have looked into it many times, but I would still like to finish this project the way I started it... With spaghetti logic
Sergey Alexandrovich Kryukov 28-Mar-13 19:29pm
Whatever, but I hope you will remember this idea...
Allister Lindamood 28-Mar-13 19:58pm
goto 4
echo logic
goto 4.982
echo good
goto 6
echo spaghetti
goto 1
echo is best
goto a
echo sir
echo logic
goto 2

Sergey Alexandrovich Kryukov 28-Mar-13 20:05pm
:-) :-)
Spaghetti... Even the batch language has calls (subroutines, with returns), did you know that?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170728.5 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100