mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-11-04 03:12:16 +08:00 
			
		
		
		
	@@ -95,7 +95,7 @@ bool FileExists(const wchar_t * filePath)
 | 
				
			|||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void StartCmder(std::wstring path, bool is_single_mode)
 | 
					void StartCmder(std::wstring path, bool is_single_mode, std::wstring taskName = L"")
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#if USE_TASKBAR_API
 | 
					#if USE_TASKBAR_API
 | 
				
			||||||
	wchar_t appId[MAX_PATH] = { 0 };
 | 
						wchar_t appId[MAX_PATH] = { 0 };
 | 
				
			||||||
@@ -180,6 +180,10 @@ void StartCmder(std::wstring path, bool is_single_mode)
 | 
				
			|||||||
		swprintf_s(args, L"/Icon \"%s\" /Title Cmder", icoPath);
 | 
							swprintf_s(args, L"/Icon \"%s\" /Title Cmder", icoPath);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!taskName.empty()) {
 | 
				
			||||||
 | 
							swprintf_s(args, L"%s /run {%s}", args, taskName.c_str());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
 | 
						SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
 | 
				
			||||||
	if (!streqi(path.c_str(), L""))
 | 
						if (!streqi(path.c_str(), L""))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -323,6 +327,10 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		StartCmder(opt.second, true);
 | 
							StartCmder(opt.second, true);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						else if (streqi(opt.first.c_str(), L"/TASK"))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							StartCmder(L"", false, opt.second);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	else if (streqi(opt.first.c_str(), L"/REGISTER"))
 | 
						else if (streqi(opt.first.c_str(), L"/REGISTER"))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		RegisterShellMenu(opt.second, SHELL_MENU_REGISTRY_PATH_BACKGROUND);
 | 
							RegisterShellMenu(opt.second, SHELL_MENU_REGISTRY_PATH_BACKGROUND);
 | 
				
			||||||
@@ -335,7 +343,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n  /START <path>\n  /SINGLE <path>\n  /REGISTER [USER/ALL]\n  /UNREGISTER [USER/ALL]", MB_TITLE, MB_OK);
 | 
							MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n  /START <path>\n  /SINGLE <path>\n  /TASK <name>\n /REGISTER [USER/ALL]\n  /UNREGISTER [USER/ALL]", MB_TITLE, MB_OK);
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user