|
Answer» Hi guys, I'm new here and I have a question.
I made a program that allows people to install patches for a game called Battlefield 2. I want to protect my copyright over it, so I'm trying to make an IF command, that if it detects that the copyright is tampered with, it shows an error message and terminates. It's not working, it goes on either if I have the copyright taken off, or if it is on. Here is the top of my code:
@echo off title Battlefield 2 Patcher v1.03 color 80 rem Excuse all the spelling errors; they're there to make the interface more user-friendly. rem I'm tired of having to guess what these commands mean in PATCHER.bat. I'm gonna fix that! cls IF "Created by xstax981"== "Created by xstax981" GOTO START ELSE GOTO FALSESTART :START rem Basic start of patcher. Also scans if PATCHER.bat is placed with the BF2.exe file. echo. echo. *************************** echo. Battlefield 2 Patcher v1.03 echo. *************************** echo. Created by xstax981 *snip* :FALSESTART rem What to call if the author's copyright is removed. title Illegal Version echo.You have a modified version of this program that has the original author's copyright STRIPPED. This program will now terminate. pause exit
Can anyone help?Seems that you forgot the brackets:
IF "Created by xstax981"=="Created by xstax981" (GOTO :START )ELSE( GOTO :FALSESTART )
hope it helps uliWhen I try to use that code, it flashes a BLANK box and exits. :-/Your IF statement compares two literals. There is no variable whose value may or may not be "Created by xstax981".
What does *snip* represent?
8-)
It was a bunch of other things in the program that weren't necessary. It was like 90 lines long and had nothing to do with the question
So what you're saying is that I should use the SET command and create a variable for it?is your copy right a text file?? if so make your code like this. With this your firs line of your readme will need to be Quote Created by xstax981 Code: [Select]@echo off title Battlefield 2 Patcher v1.03 color 80 :: Excuse all the spelling errors; they're there to make the interface more user-friendly. :: I'm tired of having to guess what these commands mean in PATCHER.bat. I'm gonna fix that! cls set goodcopyright=Created by xstax981 for /f "tokens=1,2,3 delims= " %%a in (readme.txt) do set copyright=%%a %%B %%c if "%copyright%" EQU "%goodcopyright%" goto :START goto :FALSESTART :START :: Basic start of patcher. Also scans if PATCHER.bat is placed with the BF2.exe file. echo. echo. *************************** echo. Battlefield 2 Patcher v1.03 echo. *************************** echo. Created by xstax981 echo. pause :FALSESTART :: What to call if the author's copyright is removed. title Illegal Version echo.You have a modified version of this program that has the original author's echo.copyright stripped. This program will now terminate. pause exit Tell me how that works for you. if you need anything changed just tell me It works, but even now if the "readme.txt" is there with the first line being "Created by xstax981", it gives ME a bad copyright notice . Ironic as I am the original author loldoes it goto the first part then goto the ilegalcopy part or just the ilegal copy part :-? Look at this file this is how i have it and i WORKE for me this way.tell me how that works
|