实现效果
(视频无声,放心观看)
原理
把 App 放到不知名文件夹,使用 txt 文件存储密码和 exe 路径,用 start 命令打开软件。(仅支持 Windows )
txt 文件格式
文件名:bump.txt。
第一行:
如果需要密码:pwd+一个空格+密码(不能包含空格)。
如果无需密码:NoPwD YeT。
第二行:一个正整数 ,表示软件的个数。
之后 行,每行两个字符串,分别表示软件名和 exe 路径(可以有中文)。
C++ 实现源码
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<conio.h>
using namespace std;
int main(){
ifstream filin;
filin.open("./bump.txt");
string type,pwd;
int n;
vector<string> apps,pths;
filin>>type>>pwd>>n;
for(int a=0;a<n;++a){string tmp,t2;filin>>tmp>>t2;apps.push_back(tmp);pths.push_back(t2);}
filin.close();
string p="";
if(type=="pwd"){
cout<<"请输入密码:";
do{
char tmp3=_getch();
if(tmp3==8){
if(p.length()!=0)p.erase(p.length()-1,1);
else return 0;
}else p+=tmp3;
system("cls");
cout<<"请输入密码:";
for(int a=0;a<p.length();++a)cout<<"*";
}while(p!=pwd);
system("cls");
}
cout<<"-----------------------------------------------"<<'\n';
cout<<"-------------------软件启动器------------------"<<'\n';
cout<<"-----------------------------------------------"<<'\n';
for(int a=0;a<n;++a)cout<<a+1<<"."<<apps[a]<<'\n';
int pt;
cout<<"请输入序号:";
cin>>pt;
string t="start "+pths[pt-1];
system(t.c_str());
return 0;
}愿大家喜欢这个“发明”。