.bat Problem

Posted on 2007-07-19
Last Modified: 2010-04-16
Hi Experts,
For a batch file, is it possible to
(1.) set it up to run at a regular time? say, on a weekly or monthly basis?
(2.) embed username and password inside in order to connect or login onto another server/account?

If it is, then how to do them?

Thanks for all replies.  
Question by:davidw88
    LVL 30

    Expert Comment

    You can schedule a task to run a batch file and run it like so:

    cmd /c c:\dir\yourbatch.bat

    When c:\dir\yourbatch.bat is the fully qualified batch file name.

    You can access a network resource by mapping to a share:

    net use z: \\server\share\dir password /user:username

    LVL 30

    Expert Comment

    A more secure method would be to set the Run as to the domain user account that has access to the network resource. This would be specified in the task scheduler and would protect the user account. Rather than hard coding the username and password in the batch file where others might be able to read it.

    Then you'd simply reference the network resource using a UNC:


    Or do net use, but without specifying the user account information. Since the task is run as the domain user account.

    Author Comment

    Hi SteveGTR,
    Thanks so much for your reply. The account that I want to access is an online account. How to create a network share drive on my local machine for this URL?

    The URL is "". I followed the "Add Network Place Wizard" to create a network drive. I put the URL as the "Internet or network address" but the system said that "The folder you entered does not appear to be valid. Please choose another."

    How to handle this?
    LVL 30

    Expert Comment

    I don't know if that's possible from the DOS prompt. It sounds like you are connecting to the server via HTTP through IE.

    Author Comment

    Hi SteveGTR: Thanks for your reply again. Here is what I am trying to do.  

    I use  a Webdav client Bitkinex to copy data from source ("") to my local machine ("c:\local\data").

    The .bat file is
    "c:\bitkinex.exe" cp c:\local\data

    The source data is located on "". When the .bat file is executed, it pops up a user name/password interface to require login for the "".

    In this case is it possible to avoid the login prompt?

    LVL 30

    Accepted Solution

    I know you can do this with ftp from IE, but you could give it a try:

    Uniform Resource Identifier in one of the following forms:

       1. Standard URI:

          Note: Paths ending with a slash are treated as directories.

    Author Comment

    Thanks a lot. I will give that a try.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
    Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
    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…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    734 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

    21 Experts available now in Live!

    Get 1:1 Help Now