CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2001
    Posts
    69

    Parameters of Dos Batch file

    Here may not be the best place to ask, but I need call my VB in a dos batch file with a parameter. Does anyone know how to pass and how to use a parameter in a dos batch file (.bat file)?
    Thanks alot

    If you love it, you get it.
    If you don't love it, you never get to it.

  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Parameters of Dos Batch file

    c:\YourVB.exe Param1

    This Param1 you can read in VB using Command$

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Jun 2001
    Posts
    69

    Re: Parameters of Dos Batch file

    I was in a mass.
    I've made an DQ_SEND.exe to let others call me in NT server.
    And now they told me that they can not call me on server, they have to call my program in their client.
    That's really a pain to set up all hundred PC to install my program and all the DataSource and DataLinks.
    So I thought if that is posiable to let them call another program (like .bat), then the other program call my VB in server?

    If you love it, you get it.
    If you don't love it, you never get to it.

  4. #4
    Join Date
    Feb 2000
    Posts
    137

    Re: Parameters of Dos Batch file

    If what you need is to pass a parameter to the batch file and have the batch file pass that parameter on to your exe, set up the batch file like this:

    [batch file contents]
    My.exe %1
    [end batch file contents]

    The %1 in the batch file will be expanded to whatever parameter that you pass by the command processor. DOS batch file command line parameters are seperated by a space, so if your parameter must contain a space you will need to surround it with quotes.

    Assuming your batch file is named My.bat and is in the same directory as the batch file (if you need it to be in a different directory you'll need to explicitly path the call in the batch file), to launch My.exe passing the parameter "wOOt!", you would use the line
    My.bat wOOt!

    Hope this helps.
    Spectre



  5. #5
    Join Date
    Jun 2001
    Posts
    69

    Re: Parameters of Dos Batch file

    Thanks! It's really helpful and it works perfact!

    If you love it, you get it.
    If you don't love it, you never get to it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured