1

I have writen in my bat file

cmd /k cd /d"C:\Users\amanz\Desktop\Introduction - Computing\Java files" 
call atomer.bat

right now, it just seems to change the directory and stops right there. It doesn't seem to call the atomer.bat file.

The following code is seen in the atomer.bat file:

start atom .

1 Answers1

1

It just seems to change the directory and stops right there

cmd /k cd /d"C:\Users\amanz\Desktop\Introduction - Computing\Java files"

There are two errors with the above:

  1. cmd /k runs a command and then returns to the CMD prompt (which terminates the batch file and goes back to the cmd shell where you called it from).

  2. You should have a space after the /d before the [drive:][path] argument.

In fact, you don't need to use cmd at all (it is not needed for what you want to do).

Use the following batch file:

cd /d "C:\Users\amanz\Desktop\Introduction - Computing\Java files" 
call atomer.bat

This assumes that atomer.bat is either:

  • located in the directory C:\Users\amanz\Desktop\Introduction - Computing\Java files, or
  • located somewhere on your path.

Further Reading

DavidPostill
  • 153,128
  • 77
  • 353
  • 394