Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
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