How can I get the current .bat directory i'm in

Posted on 2012-09-10
Last Modified: 2012-09-11
I'm trying to figure out how to get the directory of a .bat file i'm currently in. Can someone help me out?

I wasn't finding what I needed on the web
Question by:Mark_Co
    LVL 9

    Assisted Solution

    by:Evan Cutler
    Look at this article.
    The user Wize Owl puts in relatively simple.
    LVL 77

    Accepted Solution

    echo %cd%
    set current = %cd%
    LVL 67

    Assisted Solution

    Attention with the example of ve3ofa! No spaces between var names, equal sign and values, as they are part of the respective value!
       set current=%cd%

    But otherwise, %cd% is the current folder, as stated, and %~dp0 is the batch file's folder. It depends on which one you want to work with.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    After playing around with my ASUS 1215n ( Netbook, I finally managed to get smooth HD 1080p ( playback of videos on it. Second Generation Intel Atom (http://en.…
    I recently purchased an HP EliteBook 2540p notebook/laptop. It has two video ports on it – VGA and DisplayPort. HP offers an optional docking station for the 2540p that also has both a VGA port and a DisplayPort. There are numerous online reports do…
    Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
    This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…

    746 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

    15 Experts available now in Live!

    Get 1:1 Help Now