Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: batch
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):
 
:load
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:
 
VERSION=ALPHA 2
Posted 28-Mar-13 12:57pm
Sicppy1.5K
Edited 28-Mar-13 13:57pm
v3
Comments
Sergey Alexandrovich Kryukov at 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 :-)
—SA
Sicppy at 28-Mar-13 18:40pm
   
I meant to make the a reply
Sicppy at 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 at 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...
—SA
Sicppy at 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 at 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...
—SA
Sicppy at 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 at 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... :-)
—SA
PIEBALDconsult at 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 at 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...
—SA
Sicppy at 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
Sergey Alexandrovich Kryukov at 3-Apr-13 0:26am
   
Good point. At least three of us know what programming is. :-)
—SA
Sicppy at 3-Apr-13 0:40am
   
Thank you for joining the party :-)
Sicppy at 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
good
Please Sign up or sign in to vote.

Solution 1

Please see my comments to the question and still consider using PowerShell:
http://en.wikipedia.org/wiki/PowerShell[^],
http://technet.microsoft.com/en-US/scriptcenter/dd742419.aspx[^].
 
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.
 
—SA
  Permalink  
Comments
Sicppy at 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 at 28-Mar-13 19:29pm
   
Whatever, but I hope you will remember this idea...
—SA
Allister Lindamood at 28-Mar-13 19:58pm
   
goto 4
:1
echo logic
goto 4.982
:2
echo good
goto 6
:4
echo spaghetti
goto 1
:4.982
echo is best
goto a
:6
echo sir
:a
echo logic
goto 2
 
exit
Sergey Alexandrovich Kryukov at 28-Mar-13 20:05pm
   
:-) :-)
Spaghetti... Even the batch language has calls (subroutines, with returns), did you know that?
—SA

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

  Print Answers RSS
0 OriginalGriff 325
1 Sergey Alexandrovich Kryukov 289
2 CPallini 275
3 DamithSL 260
4 Maciej Los 215
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2014
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