PPRuNe Forums - View Single Post - Running a batch file under XP
View Single Post
Old 17th October 2005 | 17:23
  #14 (permalink)  
Saab Dastard
Administrator
 
Joined: Mar 2001
: PPL
Posts: 8,121
Likes: 686
From: Twickenham, home of rugby
LurkR,

The problem is almost certainly the "Exit" command.

Remove it and all should be well - Mac mentioned it already.

Shuttlebus & Seacue - you both need to brush up on elementary directory structures!

(Mounts soap box)

The command (batch file) can be located anywhere if the location of the target file is EXPLICIT, i.e. C: \myfiles\file1.xls (absolute path). In this situation there is no possibility of any file(s) other than the desired target being modified IRRESPECTIVE of wherever the batch file is located.

With an implicit or relative file location, e.g. file1.xls or \myfiles\file1.xls, the location of the file is assumed by the command interpreter to be relative to the current directory. So if the command states a relative path, The relationship of the command and target would need to be in the same relation, if not the same directory.

It is perfectly possible to have all batch files in a single directory (it used to be good practice to do so), totally separate from the data upon which they operate.

Calling the batch file could be done from anywhere in the directory by invoking the absolute path to it, with the commands in the batch file referencing absolute or relative paths as appropriate to their function.

BTW, it is incorrect to say that commands are executed in a particular directory (commands are not executed in ANY directory) - it is true that the default current directory for the CMD interpreter is C: \documents and settings\username.

(Dismounts soap box).

SD
Saab Dastard is offline