running a program from a BAT

Posted on 2007-08-07
Last Modified: 2013-11-05
I am trying to run a program from within a BAT file.

It maps a drive

Net use T: \\server\share


The problem I am having is that it runs the program in the context of the c: not the t: and I need it to run as if from the t:

If I open the drive and double slick it works, or if from the CMD I put in cd t: the type setup.bat it works fine.

What can I do to make the BAT file run the program from within the t: ?
Question by:ChicagoMikeW
    LVL 3

    Assisted Solution



    above where you reference the .bat file.  It changes your context to T:  You could also use absolute paths instead of referential paths.
    LVL 30

    Expert Comment

    I'd recommend this:

    Net use T: \\server\share

    cd /r t:\

    LVL 30

    Accepted Solution

    Opps, wrong switch. It should be /d:

    Net use T: \\server\share

    cd /d t:\


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    745 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