If not %version%==%keyversion% goto new

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
TheBads
Posts: 3
Joined: 03 Apr 2016 02:17

If not %version%==%keyversion% goto new

#1 Post by TheBads » 03 Apr 2016 02:27

I'm making a program and I want to make check by using save.bat
In save.bat version=0.1 and in program it self is keyversion=0.2
And if version and keyversion would be same it will goto somewhere
And if version isn't same like keyversion (will be different) will go to New.
But I have problems.

(sorry for my English)

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: If not %version%==%keyversion% goto new

#2 Post by Squashman » 03 Apr 2016 07:59

How do you expect anyone to help you when you have not provided any code for us to help you with?

Hradschek
Posts: 10
Joined: 03 Apr 2016 12:39
Location: Germany

Re: If not %version%==%keyversion% goto new

#3 Post by Hradschek » 07 Apr 2016 15:12

@Sqaushman: maybe he has no code yet.

Test this:

Code: Select all

if %version%==%keyversion% goto somewhere
:somewhere
rem Some code to execute here


And

Code: Select all

if %version% LSS %keyversion% goto new
:new
rem code....


But you have to do:

Code: Select all

set /a savegameversion=1
set /a keyversion=2


That LSS will work correctly.


I hope i was able to help you.


Greetings,

Hradschek

TheBads
Posts: 3
Joined: 03 Apr 2016 02:17

Re: If not %version%==%keyversion% goto new

#4 Post by TheBads » 30 Apr 2016 03:02

Sorry for long time no reply. I don't want people to see my code. And BTW It's single line error. I get "Goto was unexpected"
Squashman wrote:How do you expect anyone to help you when you have not provided any code for us to help you with?

TheBads
Posts: 3
Joined: 03 Apr 2016 02:17

Re: If not %version%==%keyversion% goto new

#5 Post by TheBads » 30 Apr 2016 03:15

Sorry for long time no reply. I don't want people to see my code. And BTW It's single line error. I get "Goto was unexpected"
In my code you first is completely same like i was trying before visiting this site and i get "Goto Unexpected" if started from cmd not double clicking .bat

Your Second code worked.
Thank you for help. I will credit you in my program (if you want) when i will release it.

Hradschek wrote:@Sqaushman: maybe he has no code yet.

Test this:

Code: Select all

if %version%==%keyversion% goto somewhere
:somewhere
rem Some code to execute here


And

Code: Select all

if %version% LSS %keyversion% goto new
:new
rem code....


But you have to do:

Code: Select all

set /a savegameversion=1
set /a keyversion=2


That LSS will work correctly.


I hope i was able to help you.


Greetings,

Hradschek

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: If not %version%==%keyversion% goto new

#6 Post by Squashman » 03 May 2016 09:57

TheBads wrote:Sorry for long time no reply. I don't want people to see my code. And BTW It's single line error. I get "Goto was unexpected"
Squashman wrote:How do you expect anyone to help you when you have not provided any code for us to help you with?

Don't expect to get any help then. Trying to help someone without seeing all the relevant pieces of code is like playing Craps in Vegas!

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: If not %version%==%keyversion% goto new

#7 Post by ShadowThief » 03 May 2016 10:28

TheBads wrote:Sorry for long time no reply. I don't want people to see my code. And BTW It's single line error. I get "Goto was unexpected"
In my code you first is completely same like i was trying before visiting this site and i get "Goto Unexpected" if started from cmd not double clicking .bat

Your Second code worked.
Thank you for help. I will credit you in my program (if you want) when i will release it.

When you're responding to somebody by quoting them, put your comments under the quote so that we know what you're responding to. If you write your post above the quote, that means it's unrelated.

Also, don't take this the wrong way, but literally everybody in this topic is better at writing code than you, so if you're worried about somebody stealing your code, don't be; we've already written our own versions of whatever it is you think you've invented.
Last edited by ShadowThief on 03 May 2016 15:48, edited 1 time in total.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: If not %version%==%keyversion% goto new

#8 Post by Squashman » 03 May 2016 12:37

Free code help is a two way street.

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: If not %version%==%keyversion% goto new

#9 Post by penpen » 03 May 2016 14:46

TheBads wrote:I don't want people to see my code.
You could remove all lines, that are not related with the error, change variable names and ... :
So noone could see your code Project (only <=10 lines in most cases).


penpen

Post Reply