Register for Semperis' Hybrid Identity Protection (HIP) Conference - June 30 - July 1 Register for Semperis' Hybrid Identity Protection (HIP) Conference - June 30 - July 1

DOS Batch file for searching a specific file

Home Forums Scripting DOS Command Shell DOS Batch file for searching a specific file

Viewing 1 post (of 1 total)
  • Author
    Posts

  • pmg
    Member
    #138789

    Below is the dos script which I have write to search files in specific folder:


    @echo
    off
    c:

    if exist c:Data*.txt (echo FILE_EXIST) else (echo FILE DOES NOT EXIST)
    PAUSE

    Now I am getting message FILE DOES NOT EXIST all the time even if the file is there.

    if i change
    if exist c:Data*.* (echo FILE_EXIST) else (echo FILE DOES NOT EXIST)

    i*.* instead of *.txt then I get FILE_EXIST message all the time even if the file is not there.

    I am not getting correct message. Any help?
    Thanks in advance.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Register for the Hybrid Identity Protection (HIP) Europe Conference!

Hybrid Identity Protection (HIP) Europe 2021 - Virtual Conference

Mobile workforces, cloud applications, and digitalization are changing every aspect of the modern enterprise. And with radical transformation come new business risks. Hybrid Identity Protection (HIP) is the premier educational forum for identity-centric practitioners. At the inaugural HIP Europe, join your local IAM experts and Microsoft MVPs to learn all the latest from the Hybrid Identity world.