Need a simple batch file that creates a file then checks for it on each run

Posted on 2004-10-22
Last Modified: 2010-04-14
Need a simple batch file that checks for the file c:\running.txt.  If not there it creates it then continues.  If it finds the file, it exits.
Question by:murryc
    LVL 11

    Accepted Solution

    Here is one:

    REM  Do things if flag file is not there, exit if its there
    set OSJOBLOG=C:\running.txt
    if exist %OSJOBLOG% goto :END
    echo test_ok>>C:\running.txt
    echo Batch File Job Complere

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Anonabox PRO Tor & VPN Router

    PRO is the most advanced way to fortify your privacy and online anonymity by layering the Tor network with VPN services. Use both together or separately, and without needing to download software onto your devices.

    Suggested Solutions

    Title # Comments Views Activity
    Cannot connect to share on new Win8 PC 3 931
    Active Directory Replication 10 1,110
    Windows 2000 Sever Lab Setup 1 634
    Windows 7 7 239
    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    Read about why website design really matters in today's demanding market.
    This video Micro Tutorial is the first in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 ( But the ability to create custom scanning profiles al…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    931 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now