How to Determine the Application Path in WinBatch?

Posted on 2006-05-23
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


    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


    Thanks for your help and immediate response. :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Title # Comments Views Activity
    countTriple  challenge 8 59
    matchUp  challenge 6 34
    thread-safe code in c++ 2 58
    groovy example issue 10 32
    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    This is an explanation of a simple data model to help parse a JSON feed
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now