用按键精灵帮我写一个每次运行改文件名称

C:\123\abc.exe ,要每次改一个名字
用一个txt文件,存要换的名字, 比如 aaa.exe bbb.exe 333.exe 666.exe, 有多少都放这个列表里面.
然后每次随便换一个名字 或者按顺序换名字, 二种
用按键精灵调用这个列表的名字,改adc.exe的名称

你大概是想要修改每次运行时按键精灵的进程名字,下面是我的代码,C语言实现,以后直接运行该程序,会自动改名,并运行改名后的程序:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

main()
{
FILE *list=fopen("list.txt","r"),*f=fopen("f.txt","r+");

char nowname[10],tmp[50][10],cmd[50];
//当前的名字 
fscanf(f,"%s",nowname);

int i=0;
while(!feof(list))
{
fscanf(list,"%s",tmp[i]);
i++;
}
fclose(f);fclose(list);

//随机一个文件名 
srand((int)time(NULL));
i=rand()%i;
//重命名 
sprintf(cmd,"rename C:\123\%s %s",nowname,tmp[i]);
system(cmd);
//保存修改后的名字 
sprintf(cmd,"\"%s\" > list.txt",tmp[i]);
//运行 
sprintf(cmd,"C:\123\%s",tmp[i]);
system(cmd);
//结束 
return 0;
}

编译后的exe同文件夹下建2个txt,f.txt储存当前文件名,list.txt储存供修改的名字。然后运行exe即可~!


附件是编译好的程序,以及实例,请下载。

希望我的回答对你有帮助,有问题请随时向我追问!

^o^

温馨提示:答案为网友推荐,仅供参考
相似回答