Running a command line from within a batch file

Posted on 2006-05-31
Last Modified: 2013-12-28
I have a command line command that I need to run from within a batch file. Here is the command:

dtsrun /Slocal /Utest /Ptest /Ntestpackage

Please send me the exact code needed within the .bat file to run this command. Thanks.

Question by:isaacr25
    LVL 82

    Expert Comment

    You already posted the exact command needed.
    A batch file is basically a series of command you would otherwise run from the command line (with some additional commands to make the work easier).
    You should specify the path to dtsrun.exe if it's not in the Path environment variable, and you could start with an "@echo off" to suppress the echoing of the commands currently executed, but otherwise, you only need this command.
    So it would come down to this:

    @echo off
    REM *** Adjust the path to the dtsrun.exe file in the following line:
    "C:\Program Files\Some\Folder\dtsrun.exe" /Slocal /Utest /Ptest /Ntestpackage

    Author Comment

    The reason I asked for additional info is that when I first ran a .bat file with just that one line of code, it kicked off 700 plus instances of the command prompt. I had to log off of the machine to stop the madness. So, the code that you pasted should avoid this? Thanks.
    LVL 82

    Accepted Solution

    You probably named the batch file dtsrun.bat; a bat file will be called before an .exe, so the batch called itself. It's always a good habit to include the extension when calling external programs.

    Author Comment

    So I just need to name the .bat file something else? Thanks.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    As the name suggests, SVCHost stands for Service Host. It is a process which hosts different services of Windows which are actually run from Dynamic Link Libraries (DLL) files. A DLL is a library that contains data (code) that could be used by mo…
    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
    The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

    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

    19 Experts available now in Live!

    Get 1:1 Help Now