2

我正在尝试在 Windows 命令行中执行单行文件下载,而不依赖于 WGET 等外部工具,甚至不编写 PowerShell 或 VBScripts 脚本。

我试着跑

c:\> RunDLL32.exe URLMon.dll,URLDownloadToFIle 0,"http://www.example.com/file.pdf" "c:\\MyName\\Downloads\\",0

它没有用。
我做错了什么?或者这甚至会起作用吗?

4

1 回答 1

5

The function URLDownloadToFile has the following signature:

HRESULT URLDownloadToFile(
         LPUNKNOWN            pCaller,
         LPCTSTR              szURL,
         LPCTSTR              szFileName,
         DWORD dwReserved,
         LPBINDSTATUSCALLBACK lpfnCB
         );

Functions callable by rundll32.exe need to have the following function prototype:

void CALLBACK  EntryPoint(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);

You aren't able to use rundll32.exe to run URLDownloadToFile, because these two prototypes are incompatible.

于 2015-08-19T06:53:49.937 回答