Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Batch file question


  • Please log in to reply

#1
Chopin

Chopin

    Member 2k

  • Member
  • PipPipPipPipPip
  • 2,639 posts
Is it possible to have a batch file display a message if two conditions are met? For instance...

@ECHO OFF
IF EXIST C:\test.txt AND C:\test.exe GOTO blah
:blah
ECHO blah
EXIT

returns the error "AND" is not a recognized...." We get the same error message using the OR command. It's possible to make it using GOTOs

@ECHO OFF
IF EXIST C:\test.txt GOTO test1
ECHO test.txt does not exist
GOTO exit
:test1
IF EXIST C:\test.exe GOTO blah
ECHO test.txt exist, test.exe does not
:exit
ECHO press any key to exit
PAUSE>NUL
:blah
ECHO blah

but it is unnecessarily tedious. So can anyone help me make it somewhat easier?
  • 0

Advertisements


#2
don77

don77

    Malware Expert

  • Retired Staff
  • 18,526 posts
Is this purposely in the XP forum ?
  • 0

#3
Chopin

Chopin

    Member 2k

  • Topic Starter
  • Member
  • PipPipPipPipPip
  • 2,639 posts
Well, it had to do with XP... it would be easier if I was running MS-DOS :whistling:

Truth be told, I couldn't find a better forum for it.
  • 0

#4
don77

don77

    Malware Expert

  • Retired Staff
  • 18,526 posts

Truth be told, I couldn't find a better forum for it.


Really ?
  • 0

#5
Chopin

Chopin

    Member 2k

  • Topic Starter
  • Member
  • PipPipPipPipPip
  • 2,639 posts
Oops... there seems to be a forum known as "Software development"... Would you be so kind as to move this thread for me?
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP