LiteSetup建立快捷方式

運行 生成的臨時vbs腳本 來生成 桌面快捷方式ios

 

vbs腳本ide

Set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\KKPlayer.lnk")
oShellLink.TargetPath = "C:\Users\hk\Desktop\KKPlayer\KKPlayer.exe"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "C:\Users\hk\Desktop\KKPlayer\KKPlayer.exe,0"
oShellLink.WorkingDirectory =  "C:\Users\hk\Desktop\KKPlayer"
oShellLink.Save

cpp代碼code

void CLiteSetupUIDlg::CreateShortcut()
{
	fstream f;
	f.open("shortcut.vbs", ios::out);

	string cmd;
	f << "Set WshShell = WScript.CreateObject(\"WScript.Shell\")" << endl;
	f << "strDesktop = WshShell.SpecialFolders(\"Desktop\")" << endl;

	cmd = "set oShellLink = WshShell.CreateShortcut(strDesktop & \"\\";
	cmd += const_for_exe::_shortcut_name;
	cmd += ".lnk\")";
	f << cmd << endl;



	cmd = "oShellLink.TargetPath = \"";
	cmd += Utils::toAscii(path1.GetBuffer(0));
	cmd += "\\";
	cmd += const_for_exe::_shortcut_exe_name;
	cmd += "\"";

	f << cmd << endl;


	f << "oShellLink.WindowStyle = 1" << endl;


	cmd = "oShellLink.IconLocation = \"";
	cmd += Utils::toAscii(path1.GetBuffer(0));
	cmd += "\\";
	cmd += const_for_exe::_shortcut_exe_name;
	cmd += ",0";
	cmd += "\"";

	f << cmd << endl;



	cmd = "oShellLink.WorkingDirectory =  \"";
	cmd += Utils::toAscii(path1.GetBuffer(0));
	cmd += "\"";

	f << cmd << endl;


	f << "oShellLink.Save" << endl;


	f.flush();
	f.close();

	//system("shortcut.vbs");

	Utils::system_hide_cmd("cmd /c shortcut.vbs");



	Utils::DeleteFileForName("shortcut.vbs");


}
相關文章
相關標籤/搜索