home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 40,695 of 42,547   
   foxidrive to blinkingblythe01@gmail.com   
   Re: Enviroment variables not staying aft   
   25 Jul 13 17:55:33   
   
   From: not@this.address.invalid   
      
   On 25/07/2013 17:37, blinkingblythe01@gmail.com wrote:   
   > On Wednesday, July 24, 2013 11:37:02 PM UTC-7, foxidrive wrote:   
   >> On 25/07/2013 15:06, blinkingblythe01@gmail.com wrote:   
   >>   
   >>>  Under Dosbox and MsDos, the counter works fine. Under windows XP's   
   command com, the counter refuses to go past 1.   
   >>   
   >>   
   >>   
   >> You have an issue with a space.  Rem out the @echo off and see what is   
   printed on the screen.   
   >>   
   >>   
   >   
   >  I got rid of the trailing spaces after the set count=# lines, but it is   
   still refusing to advance past one. I noticed when echo off is rem'd, I get   
   > "" == "" in the goto lines, I don't know if this is related to the problem   
   or not.   
      
   It works here when I removed the trailing spaces.   
      
   Here is a basic XP version:   
      
   @echo off   
   set /a count=count+1   
   echo %coount%   
      
      
      
      
   And here is your version which counted up to 50 ok.   
      
   @echo off   
   rem Here is one application for using the counter if you want to limit   
      
   rem how many times someone can access a program   
      
   rem (note this line must be placed right at the beginning of the file)   
      
   rem You also have to put a line like this in your AUTOEXEC.bat   
      
   rem set lock=unlocked   
      
   rem because if it reads all 4 variables as blank it will think that the   
      
   rem limit is set at null and it wont work. also after 99 the file will put   
      
   rem a 0 before the 2nd digit so you may have to reset the limit and   
      
   rem include the 0. for example 01. If it is double digit, you do not   
      
   rem have to change anything.   
      
    rem remember not to include rem in this line.   
      
    rem if "%lock2%%lock%"=="%count2%%count%" goto locked   
      
    rem This is a Batch counter. Every time this file runs it will count up   
      
    rem one number.   
      
   if "%count%"=="" goto 0   
      
   if "%count%"=="0" goto 0   
      
      
   if "%count%"=="1" goto 1   
      
   if "%count%"=="2" goto 2   
      
   if "%count%"=="3" goto 3   
      
   if "%count%"=="4" goto 4   
      
   if "%count%"=="5" goto 5   
      
   if "%count%"=="6" goto 6   
      
   if "%count%"=="7" goto 7   
      
   if "%count%"=="8" goto 8   
      
   if "%count%"=="9" goto 9   
      
   goto end   
      
    :0   
      
   set count=1   
      
    goto end   
      
    :1   
      
   set count=2   
      
    goto end   
      
    :2   
      
   set count=3   
      
    goto end   
      
    :3   
      
   set count=4   
      
    goto end   
      
    :4   
      
   set count=5   
      
    goto end   
      
    :5   
      
   set count=6   
      
    goto end   
      
    :6   
      
   set count=7   
      
    goto end   
      
    :7   
      
   set count=8   
      
    goto end   
      
    :8   
      
   set count=9   
      
    goto end   
      
    :9   
      
   set count=0   
      
   if "%count2%"=="" goto 11   
      
   if "%count2%"=="1" goto 12   
      
   if "%count2%"=="2" goto 13   
      
   if "%count2%"=="3" goto 14   
      
   if "%count2%"=="4" goto 15   
      
   if "%count2%"=="5" goto 16   
      
   if "%count2%"=="6" goto 17   
      
   if "%count2%"=="7" goto 18   
      
   if "%count2%"=="8" goto 19   
      
   if "%count2%"=="9" goto 20   
      
    :11   
      
   set count2=1   
      
    goto end   
      
    :12   
      
   set count2=2   
      
    goto end   
      
    :13   
      
   set count2=3   
      
    goto end   
      
    :14   
      
   set count2=4   
      
    goto end   
      
    :15   
      
   set count2=5   
      
    goto end   
      
    :16   
      
   set count2=6   
      
    goto end   
      
    :17   
      
   set count2=7   
      
    goto end   
      
    :18   
      
   set count2=8   
      
    goto end   
      
    :19   
      
   set count2=9   
      
    :20   
      
   set count2=0   
      
    goto end   
      
    :locked   
      
    echo Sorry, You cannot access this file after %count2%%count% times   
      
    goto end   
      
    :end   
      
    echo %count2%%count%   
      
    rem To set the lock: Just type these 2 lines:   
      
    rem set lock=n where n is the first digit in the number   
      
    rem set lock2=n where n is the second digit in the number   
      
    rem if you are setting only a 1 digit number type   
      
    rem set lock=n   
      
    rem set lock=   
      
      
      
      
      
      
      
      
   --   
   foxi   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca