Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: make that batch file can only be opened once  (Read 2175 times)

0 Members and 1 Guest are viewing this topic.

newbie to batch

  • Guest
make that batch file can only be opened once
« on: November 17, 2005, 12:48:54 PM »
hi, i would like to make a batch file that shows a text (example hello) but if you open it for the second time, you may not see the text again but a text like; you alrady seen it once. Can sombody help me??

;D

Blackberry



    Adviser
  • For those with wings, fly to your dreams.
    Re: make that batch file can only be opened once
    « Reply #1 on: November 17, 2005, 12:52:00 PM »
    if you work under windows xp this should work:

    @echo off
    if exist %temp%/opened.txt goto opened
    echo.
    echo  hello
    echo.
    goto end
    >> %temp%/opened.txt ECHO opened
    :opened
    echo.
    echo you allready seen it once
    echo.
    goto end
    :end
    pause

    i hope this helps

    (this isn't the best way for doing this i think, but it should give you a start)

    greetz

    blackberry  8)
    « Last Edit: November 17, 2005, 12:52:17 PM by blackberry »
    Everybody knows you can't click here. But I know you will try it :)

    Darkon

    • Guest
    Re: make that batch file can only be opened once
    « Reply #2 on: March 07, 2006, 06:16:52 AM »
    well, i created something simmilar as an uninstall batch for some dos tools i created. at the end of the batch i simply told it to delete itself.

    ex:
    batch.bat
    ---------------
    echo.this is some code
    echo.this is some more code
    echo.this is even more code
    del batch.bat /q

    DosItHelp



      Intermediate
      Re: make that batch file can only be opened once
      « Reply #3 on: March 08, 2006, 11:07:35 PM »
      Tip:
      To delete the batch file independent from it's name and the 'current' directory use:

      del "%~f0" /q

      Hope this info is useful :;
      « Last Edit: March 25, 2006, 10:44:18 PM by DosItHelp »