Coming Soon: GET-IT: Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET-IT: Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET

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.

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: