CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Command Prompt

  1. #1
    Join Date
    Feb 2010
    Posts
    6

    Unhappy Command Prompt

    HI ,
    i'm new to .net, i'm tring to execute some commands in cmd prompt in vs 2008. can any pls help me.... (with out using BATCH FILE)

    i want to execute the following commands....
    ----> FTP
    ----> open server name
    ----> user name
    ----> pswd
    etc....

    thanks in advance.....

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Command Prompt

    Code:
    Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _
        (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, _
        ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
    Defines the API:

    Code:
    lngINetConn = InternetConnect(lngINet, “ftp.microsoft.com”, 0, _
        “anonymous”, “[email protected]”, 1, 0, 0)
    That assigns to a variable:

    Code:
    Private Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" _
        (ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _
        ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean, _
        ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, _
        ByVal dwContext As Long) As Boolean
    Will get a file:

    Code:
    blnRC = FtpGetFile(lngINetConn, “dirmap.txt”, “c:\dirmap.txt”, 0, 0, 1, 0)
    Stores a file:

    Code:
    Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
    Defines the API:

    Code:
    InternetCloseHandle lngINetConn
    InternetCloseHandle lngINet
    And, closes the file

    Or, try this: http://www.15seconds.com/component/pg001109.htm
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Feb 2010
    Posts
    6

    Smile Re: Command Prompt

    Quote Originally Posted by dglienna View Post
    Code:
    Private Declare Function InternetOpen Lib "wininet.dll"


    Thanks Alot for the reply....................
    Last edited by Cimperiali; February 22nd, 2010 at 07:10 PM. Reason: added missed endings tags

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Command Prompt

    prince_XY143, I have noticed that you are struggling to Quote somebody. You will see at the bottom right of each post, there is a button labelled Quote, it is next to the Edit button. That is all you have to click

  5. #5
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Command Prompt

    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

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