How to Determine the Application Path in WinBatch?

Posted on 2006-05-23
Medium Priority
Last Modified: 2011-10-03
I am writing a program in WinBatch and want to get the current application’s path(the folder path where the application resides and runs from). I have used “FilePath (filename)” function but it searches for the specified file into Current Working Directory only and not on entire disk. The application can be on any location on to the hard drive, when the application will be executed then it should determine its own path (where it is residing)?
Does any one of you have any idea how to achieve this?

Question by:vineetmamgain

Accepted Solution

BraveLad earned 800 total points
ID: 16749101

I am just a beginner in Winbatch, but I have a similar problem. I was just reading backwards through the "Quick Function/Syntax Reference" appendix in the Windows interface Language (WIL) Reference Manual for Winbatch and I stumbled across 'IntControl(1004, 0, 0, 0, 0)'.

Why was I reading backwards? Well I am just a backwards kind of guy, that's all!

Instead of taking a parameter of a file name, IntControl takes the implicit input of which task is running right now (or possibly spawned it). So, you don't even have to know which file is the origin of the currently executing program. This IntControl(1004,....) will tell you the name of this file. Therefore, this answer is different from your concept, where you tell it the file name. It tells YOU the file name! And, not only that, it tells you the path you were seeking of that file name.

I hope this helps.

Author Comment

ID: 16749210

Thanks for your help and immediate response. :)

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question