0

I have a shortcut that points to ant.bat (apache ant). Executing that shortcut always returns the fail error ("build.xml does not exists"), while executing the ant.bat directly with full path does not.

This happens in both cmd and PowerShell.

Also calling the shortcut in PowerShell always invokes a cmd window to run the program instead of running it inside PowerShell.

Why does this happen? And how to make the shortcut behave like the program itself? Is it possible or is this a feature by design?

I'm using Windows 7 SP1

1 Answer 1

1
  1. Right-click on your shortcut
  2. Open Properties
  3. Open "Shortcut" tab
  4. Change the "Start in" field to the folder containing your batch file.

By design, it defaults to the folder where the shortcut itself is. That way, the shortcut behaves exactly like an executable file, i.e. its current working directory at startup is the one it is located in.

BTW, my Windows is localized so the actual names of things you have to click and change may be different (especially the "Start in" field).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .