Google Answers Logo
View Question
 
Q: Computer Question ( Answered,   2 Comments )
Question  
Subject: Computer Question
Category: Computers > Operating Systems
Asked by: anniep77-ga
List Price: $10.00
Posted: 04 Jan 2005 08:55 PST
Expires: 03 Feb 2005 08:55 PST
Question ID: 451678
I am trying to run a batch at the command prompt I get error that
say's contact.bat is not recognized as an internal or external
command, operable program or batch file.  I ran it before and it
worked for some reason it is not working now.  I am not sure what this
means
Answer  
Subject: Re: Computer Question
Answered By: webadept-ga on 04 Jan 2005 09:34 PST
 
Hi,

In order to run a program from the command line, the computer goes
through a number of steps to see if it can find it. First it starts in
the directory you are in, when you typed the command. You can check to
see if your batch file is in this directory by typing  "dir" without
the quotes. In fact, any time I give you a command within quotes,
don't use the quotes, just the command.

The next place the computer checks is your PATH, which is a list of
directories given to the computer as 'okay to look at' and if computer
finds the program in one of those directories it will run it as well.
You can get a list of the directories in your PATH by typing in the
command "path".

If the program or batch file you are trying to run is not in your
current directory, or in a directory inside your PATH list, then the
computer will not be able to find the batch file, and will not be able
to run it.

Use your Find (Start->Search->Files or Folders) utility to find your
batch file. Then write down the directory it is in. It is very likely
that in order to run correctly that the batch file needs to be in the
directory you found it in, so don't move it.

Next open your Command Prompt window, and change the directory to the
directory you found the script in. So if you found the script in
C:\utils\programs\batch you would type in "cd c:\utils\programs\batch"
and then type in the name of the batch file, and it should run. "cd"
is the command to change directories.

You can also run the batch file by using the full path and the name at
the end, but with batch files, this is not usually a good idea, unless
they were written very well. Your current directory is still the same
when you do this, and most of the time batch files are just quick
utils for a specific job, and if you were going to spend a great deal
of time putting in error checking and things, you would probably use a
different method, and not a batch script (this is just from past
experience, I've seen some very well done batch files in the past as
well, but not often).

Jan's Computer Basics
http://www.jegsworks.com/Lessons/reference/doscommands.htm

DOS TUTORIAL : THE BASICS 
http://www.glue.umd.edu/~nsw/ench250/dostutor.htm

DOS Batch File Tutorial
http://www.chebucto.ns.ca/~ak621/DOS/BatBasic.html

Search Terms
DOS Command Basics
DOS batch file Basics

thanks, 

webadept-ga
Comments  
Subject: Re: Computer Question
From: probonopublico-ga on 04 Jan 2005 09:11 PST
 
Is 'contact.bat' listed in the directory that you are trying to run it from?
Subject: Re: Computer Question
From: lauridsd-ga on 04 Jan 2005 10:52 PST
 
If you are smart enough to write a batch file, this is probably not
the answer, but check this:

Have you turned on the ability to see file extensions in windows?  If
not, it is possible that windows saved the batch file with a different
extension (".txt" if you created the file in Notepad, for example,)
and you simply cannot tell since windows is hiding the "true" file
extensions by default.  Hence, you will never be able to run
"contact.bat" since the file name is actually "contact.bat.txt".

The way to check this is to open any directory folder / My Computer
window, click the Tools menu, then Folder Options.  Click the View tab
and uncheck the box next to "Hide extensions for known file types."

Hope that helps.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy