mirror of
https://github.com/cmderdev/cmder.git
synced 2025-07-17 21:19:41 +08:00
Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
3163d6d1c3 | |||
5c7f4943ad | |||
378ebff566 | |||
572a94ca3a | |||
22aa59bd83 | |||
eb6a332da2 | |||
dd614642b2 | |||
036cf09360 | |||
7203671fc9 | |||
787ac3773c | |||
b16aa7a29e | |||
d8e8fc8adb | |||
0efeaa91fa | |||
8c0817941e | |||
e17b04cbb9 | |||
e904ebce72 | |||
a226019d5a | |||
d04cc1f04e |
2
.gitignore
vendored
2
.gitignore
vendored
@ -13,6 +13,8 @@ vendor/*/*
|
|||||||
config/*
|
config/*
|
||||||
!config/Readme.md
|
!config/Readme.md
|
||||||
|
|
||||||
|
config_user/*
|
||||||
|
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
*.exe
|
*.exe
|
||||||
*.dll
|
*.dll
|
||||||
|
15
README.md
15
README.md
@ -41,12 +41,15 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can
|
|||||||
## Cmder.exe Command Line Arguments
|
## Cmder.exe Command Line Arguments
|
||||||
|
|
||||||
|
|
||||||
| Argument | Description |
|
| Argument | Description |
|
||||||
| ------------------- | ----------------------------------------------------------------------- |
|
| ------------------- | ----------------------------------------------------------------------- |
|
||||||
| `/C [user_root_path]` | Individual user Cmder root folder. Example: `%userprofile%\cmder_config` |
|
| `/C [user_root_path]` | Individual user Cmder root folder. Example: `%userprofile%\cmder_config` |
|
||||||
| `/SINGLE` | Start Cmder in single mode. |
|
| `/M` | Use `conemu-%computername%.xml` for ConEmu settings storage instead of `user_conemu.xml` |
|
||||||
| `/START [start_path]` | Folder path to start in. |
|
| `/REGISTER [ALL, USER]` | Register a Windows Shell Menu shortcut. |
|
||||||
| `/TASK [task_name]` | Task to start after launch. |
|
| `/UNREGISTER [ALL, USER]` | Un-register a Windows Shell Menu shortcut. |
|
||||||
|
| `/SINGLE` | Start Cmder in single mode. |
|
||||||
|
| `/START [start_path]` | Folder path to start in. |
|
||||||
|
| `/TASK [task_name]` | Task to start after launch. |
|
||||||
|
|
||||||
## Context Menu Integration
|
## Context Menu Integration
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ bool FileExists(const wchar_t * filePath)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"")
|
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true)
|
||||||
{
|
{
|
||||||
#if USE_TASKBAR_API
|
#if USE_TASKBAR_API
|
||||||
wchar_t appId[MAX_PATH] = { 0 };
|
wchar_t appId[MAX_PATH] = { 0 };
|
||||||
@ -91,6 +91,8 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
wchar_t userAliasesPath[MAX_PATH] = { 0 };
|
wchar_t userAliasesPath[MAX_PATH] = { 0 };
|
||||||
wchar_t legacyUserAliasesPath[MAX_PATH] = { 0 };
|
wchar_t legacyUserAliasesPath[MAX_PATH] = { 0 };
|
||||||
wchar_t args[MAX_PATH * 2 + 256] = { 0 };
|
wchar_t args[MAX_PATH * 2 + 256] = { 0 };
|
||||||
|
wchar_t userConEmuCfgPath[MAX_PATH] = { 0 };
|
||||||
|
|
||||||
|
|
||||||
std::wstring cmderStart = path;
|
std::wstring cmderStart = path;
|
||||||
std::wstring cmderTask = taskName;
|
std::wstring cmderTask = taskName;
|
||||||
@ -147,7 +149,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Was -c [path] specified?
|
Was /c [path] specified?
|
||||||
*/
|
*/
|
||||||
if (wcscmp(userConfigDirPath, L"") == 0)
|
if (wcscmp(userConfigDirPath, L"") == 0)
|
||||||
{
|
{
|
||||||
@ -216,34 +218,86 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
// Set path to Cmder user ConEmu config file
|
// Set path to Cmder user ConEmu config file
|
||||||
PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
PathCombine(userCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||||
|
|
||||||
if (PathFileExists(cpuCfgPath)) // config/ConEmu-%COMPUTERNAME%.xml file exists, use it.
|
if ( PathFileExists(cpuCfgPath) || use_user_cfg == false ) // config/ConEmu-%COMPUTERNAME%.xml file exists or /m was specified on command line, use machine specific config.
|
||||||
{
|
{
|
||||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml.
|
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||||
{
|
{
|
||||||
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml.
|
||||||
{
|
{
|
||||||
MessageBox(NULL,
|
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
||||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
{
|
||||||
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
|
MessageBox(NULL,
|
||||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP);
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
exit(1);
|
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
|
||||||
|
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file
|
||||||
|
{
|
||||||
|
if (!CopyFile(cpuCfgPath, cfgPath, FALSE))
|
||||||
|
{
|
||||||
|
MessageBox(NULL,
|
||||||
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
|
? L"Failed to copy conig/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||||
|
: L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // vendor/conemu-maximus5/ConEmu.xml config file does not exist, copy config/ConEmu-%COMPUTERNAME%.xml to vendor/conemu-maximus5/ConEmu.xml file
|
else // '/c [path]' was specified, don't copy anything and use existing conemu-%COMPUTERNAME%.xml to start comemu.
|
||||||
{
|
{
|
||||||
if (!CopyFile(cpuCfgPath, cfgPath, FALSE))
|
if (use_user_cfg == false && PathFileExists(cfgPath) && !PathFileExists(cpuCfgPath)) // vendor/conemu-maximus5/ConEmu.xml file exists, copy vendor/conemu-maximus5/ConEmu.xml to config/ConEmu-%COMPUTERNAME%.xml.
|
||||||
{
|
{
|
||||||
MessageBox(NULL,
|
if (!CopyFile(cfgPath, cpuCfgPath, FALSE))
|
||||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
{
|
||||||
? L"Failed to copy conig/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
MessageBox(NULL,
|
||||||
: L"Failed to copy config/ConEmu-%COMPUTERNAME%.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
exit(1);
|
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml! Access Denied."
|
||||||
|
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/ConEmu-%COMPUTERNAME%.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PathCombine(userConEmuCfgPath, userConfigDirPath, L"ConEmu-%COMPUTERNAME%.xml");
|
||||||
|
ExpandEnvironmentStrings(userConEmuCfgPath, userConEmuCfgPath, sizeof(userConEmuCfgPath) / sizeof(userConEmuCfgPath[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it.
|
else if (PathFileExists(userCfgPath)) // config/user_conemu.xml exists, use it.
|
||||||
{
|
{
|
||||||
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml.
|
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||||
|
{
|
||||||
|
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml.
|
||||||
|
{
|
||||||
|
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||||
|
{
|
||||||
|
MessageBox(NULL,
|
||||||
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
|
? L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml! Access Denied."
|
||||||
|
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // vendor/conemu-maximus5/ConEmu.xml does not exist, copy config/user-conemu.xml to vendor/conemu-maximus5/ConEmu.xml
|
||||||
|
{
|
||||||
|
if (!CopyFile(userCfgPath, cfgPath, FALSE))
|
||||||
|
{
|
||||||
|
MessageBox(NULL,
|
||||||
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
|
? L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||||
|
: L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // '/c [path]' was specified, don't copy anything and use existing user_conemu.xml to start comemu.
|
||||||
|
{
|
||||||
|
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||||
|
{
|
||||||
|
if (PathFileExists(cfgPath)) // vendor/conemu-maximus5/ConEmu.xml exists, copy vendor/conemu-maximus5/ConEmu.xml to config/user_conemu.xml
|
||||||
{
|
{
|
||||||
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
if (!CopyFile(cfgPath, userCfgPath, FALSE))
|
||||||
{
|
{
|
||||||
@ -253,15 +307,25 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
else // vendor/ConEmu.xml.default config exists, copy Cmder vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml.
|
||||||
|
{
|
||||||
|
if (!CopyFile(defaultCfgPath, cfgPath, FALSE))
|
||||||
|
{
|
||||||
|
MessageBox(NULL,
|
||||||
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
|
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||||
|
: L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // vendor/conemu-maximus5/ConEmu.xml does not exist, copy config/user-conemu.xml to vendor/conemu-maximus5/ConEmu.xml
|
else {
|
||||||
{
|
if (!CopyFile(defaultCfgPath, cfgPath, FALSE))
|
||||||
if (!CopyFile(userCfgPath, cfgPath, FALSE))
|
|
||||||
{
|
{
|
||||||
MessageBox(NULL,
|
MessageBox(NULL,
|
||||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
? L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
||||||
: L"Failed to copy config/user-conemu.xml file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
: L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,18 +340,20 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
: L"Failed to copy vendor/conemu-maximus5/ConEmu.xml file to config/user-conemu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||||
}
|
}
|
||||||
else // vendor/ConEmu.xml config exists, copy Cmder vendor/ConEmu.xml file to vendor/conemu-maximus5/ConEmu.xml.
|
else // '/c [path]' was specified and 'vendor/ConEmu.xml.default' config exists, copy Cmder 'vendor/ConEmu.xml.default' file to '[user specified path]/config/user_ConEmu.xml'.
|
||||||
{
|
{
|
||||||
if ( ! CopyFile(defaultCfgPath, cfgPath, FALSE))
|
if ( ! CopyFile(defaultCfgPath, userCfgPath, FALSE))
|
||||||
{
|
{
|
||||||
ShowErrorAndExit(GetLastError(), __WFUNCTION__, __LINE__);
|
|
||||||
MessageBox(NULL,
|
MessageBox(NULL,
|
||||||
(GetLastError() == ERROR_ACCESS_DENIED)
|
(GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
? L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml! Access Denied."
|
? L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml! Access Denied."
|
||||||
: L"Failed to copy vendor/ConEmu.xml.default file to vendor/conemu-maximus5/ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
: L"Failed to copy vendor/ConEmu.xml.default file to [user specified path]/config/user_ConEmu.xml!", MB_TITLE, MB_ICONSTOP);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
PathCombine(userConEmuCfgPath, userConfigDirPath, L"user-ConEmu.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSTEM_INFO sysInfo;
|
SYSTEM_INFO sysInfo;
|
||||||
@ -301,27 +367,26 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe");
|
PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder", args, icoPath);
|
||||||
|
|
||||||
|
if (!streqi(cmderStart.c_str(), L""))
|
||||||
|
{
|
||||||
|
swprintf_s(args, L"%s /dir \"%s\"", args, cmderStart.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
if (is_single_mode)
|
if (is_single_mode)
|
||||||
{
|
{
|
||||||
if (!streqi(cmderTask.c_str(), L""))
|
swprintf_s(args, L"%s /single", args);
|
||||||
{
|
|
||||||
swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", args, icoPath, cmderStart.c_str(), cmderTask.c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
swprintf_s(args, L"%s /single /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (!streqi(cmderTask.c_str(), L""))
|
||||||
{
|
{
|
||||||
if (!streqi(cmderTask.c_str(), L""))
|
swprintf_s(args, L"%s /run {%s}", args, cmderTask.c_str());
|
||||||
{
|
}
|
||||||
swprintf_s(args, L"/Icon \"%s\" /Title Cmder /dir \"%s\" /run {%s}", icoPath, cmderStart.c_str(), cmderTask.c_str());
|
|
||||||
}
|
if (cfgRoot.length() != 0)
|
||||||
else
|
{
|
||||||
{
|
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
|
||||||
swprintf_s(args, L"%s /Icon \"%s\" /Title Cmder /dir \"%s\"", args, icoPath, cmderStart.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
|
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
|
||||||
@ -387,8 +452,10 @@ HKEY GetRootKey(std::wstring opt)
|
|||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName)
|
void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName, std::wstring cfgRoot = L"")
|
||||||
{
|
{
|
||||||
|
wchar_t userConfigDirPath[MAX_PATH] = { 0 };
|
||||||
|
|
||||||
// First, get the paths we will use
|
// First, get the paths we will use
|
||||||
|
|
||||||
wchar_t exePath[MAX_PATH] = { 0 };
|
wchar_t exePath[MAX_PATH] = { 0 };
|
||||||
@ -397,7 +464,16 @@ void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName)
|
|||||||
GetModuleFileName(NULL, exePath, sizeof(exePath));
|
GetModuleFileName(NULL, exePath, sizeof(exePath));
|
||||||
|
|
||||||
wchar_t commandStr[MAX_PATH + 20] = { 0 };
|
wchar_t commandStr[MAX_PATH + 20] = { 0 };
|
||||||
swprintf_s(commandStr, L"\"%s\" \"%%V\"", exePath);
|
|
||||||
|
if (cfgRoot.length() == 0) // '/c [path]' was NOT specified
|
||||||
|
{
|
||||||
|
swprintf_s(commandStr, L"\"%s\" \"%%V\"", exePath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath);
|
||||||
|
userConfigDirPath[cfgRoot.length()] = 0;
|
||||||
|
swprintf_s(commandStr, L"\"%s\" /c \"%s\" \"%%V\"", exePath, userConfigDirPath);
|
||||||
|
}
|
||||||
|
|
||||||
// Now that we have `commandStr`, it's OK to change `exePath`...
|
// Now that we have `commandStr`, it's OK to change `exePath`...
|
||||||
PathRemoveFileSpec(exePath);
|
PathRemoveFileSpec(exePath);
|
||||||
@ -443,6 +519,7 @@ struct cmderOptions
|
|||||||
std::wstring cmderTask = L"";
|
std::wstring cmderTask = L"";
|
||||||
std::wstring cmderRegScope = L"USER";
|
std::wstring cmderRegScope = L"USER";
|
||||||
bool cmderSingle = false;
|
bool cmderSingle = false;
|
||||||
|
bool cmderUserCfg = true;
|
||||||
bool registerApp = false;
|
bool registerApp = false;
|
||||||
bool unRegisterApp = false;
|
bool unRegisterApp = false;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
@ -460,98 +537,105 @@ cmderOptions GetOption()
|
|||||||
{
|
{
|
||||||
|
|
||||||
// MessageBox(NULL, szArgList[i], L"Arglist contents", MB_OK);
|
// MessageBox(NULL, szArgList[i], L"Arglist contents", MB_OK);
|
||||||
if (_wcsicmp(L"/c", szArgList[i]) == 0)
|
if (cmderOptions.error == false) {
|
||||||
{
|
if (_wcsicmp(L"/c", szArgList[i]) == 0)
|
||||||
TCHAR userProfile[MAX_PATH];
|
{
|
||||||
const DWORD ret = GetEnvironmentVariable(L"USERPROFILE", userProfile, MAX_PATH);
|
TCHAR userProfile[MAX_PATH];
|
||||||
|
const DWORD ret = GetEnvironmentVariable(L"USERPROFILE", userProfile, MAX_PATH);
|
||||||
|
|
||||||
wchar_t cmderCfgRoot[MAX_PATH] = { 0 };
|
wchar_t cmderCfgRoot[MAX_PATH] = { 0 };
|
||||||
PathCombine(cmderCfgRoot, userProfile, L"cmder_cfg");
|
PathCombine(cmderCfgRoot, userProfile, L"cmder_cfg");
|
||||||
|
|
||||||
cmderOptions.cmderCfgRoot = cmderCfgRoot;
|
cmderOptions.cmderCfgRoot = cmderCfgRoot;
|
||||||
|
|
||||||
if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/')
|
if (szArgList[i + 1] != NULL && szArgList[i + 1][0] != '/')
|
||||||
{
|
|
||||||
cmderOptions.cmderCfgRoot = szArgList[i + 1];
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (_wcsicmp(L"/start", szArgList[i]) == 0)
|
|
||||||
{
|
|
||||||
int len = wcslen(szArgList[i + 1]);
|
|
||||||
if (wcscmp(&szArgList[i + 1][len - 1], L"\"") == 0)
|
|
||||||
{
|
|
||||||
szArgList[i + 1][len - 1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PathFileExists(szArgList[i + 1]))
|
|
||||||
{
|
|
||||||
cmderOptions.cmderStart = szArgList[i + 1];
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (_wcsicmp(L"/task", szArgList[i]) == 0)
|
|
||||||
{
|
|
||||||
cmderOptions.cmderTask = szArgList[i + 1];
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else if (_wcsicmp(L"/single", szArgList[i]) == 0)
|
|
||||||
{
|
|
||||||
cmderOptions.cmderSingle = true;
|
|
||||||
}
|
|
||||||
else if (_wcsicmp(L"/register", szArgList[i]) == 0)
|
|
||||||
{
|
|
||||||
cmderOptions.registerApp = true;
|
|
||||||
cmderOptions.unRegisterApp = false;
|
|
||||||
if (szArgList[i + 1] != NULL)
|
|
||||||
{
|
|
||||||
if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0)
|
|
||||||
{
|
{
|
||||||
cmderOptions.cmderRegScope = szArgList[i + 1];
|
cmderOptions.cmderCfgRoot = szArgList[i + 1];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (_wcsicmp(L"/start", szArgList[i]) == 0)
|
||||||
else if (_wcsicmp(L"/unregister", szArgList[i]) == 0)
|
|
||||||
{
|
|
||||||
cmderOptions.unRegisterApp = true;
|
|
||||||
cmderOptions.registerApp = false;
|
|
||||||
if (szArgList[i + 1] != NULL)
|
|
||||||
{
|
{
|
||||||
if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0)
|
int len = wcslen(szArgList[i + 1]);
|
||||||
|
if (wcscmp(&szArgList[i + 1][len - 1], L"\"") == 0)
|
||||||
{
|
{
|
||||||
cmderOptions.cmderRegScope = szArgList[i + 1];
|
szArgList[i + 1][len - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PathFileExists(szArgList[i + 1]))
|
||||||
|
{
|
||||||
|
cmderOptions.cmderStart = szArgList[i + 1];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox(NULL, szArgList[i + 1], L"/START - Folder does not exist!", MB_OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (_wcsicmp(L"/task", szArgList[i]) == 0)
|
||||||
else if (cmderOptions.cmderStart == L"")
|
|
||||||
{
|
|
||||||
int len = wcslen(szArgList[i]);
|
|
||||||
if (wcscmp(&szArgList[i][len - 1], L"\"") == 0)
|
|
||||||
{
|
{
|
||||||
szArgList[i][len - 1] = '\0';
|
cmderOptions.cmderTask = szArgList[i + 1];
|
||||||
}
|
|
||||||
|
|
||||||
if (PathFileExists(szArgList[i]))
|
|
||||||
{
|
|
||||||
cmderOptions.cmderStart = szArgList[i];
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
else if (_wcsicmp(L"/single", szArgList[i]) == 0)
|
||||||
|
{
|
||||||
|
cmderOptions.cmderSingle = true;
|
||||||
|
}
|
||||||
|
else if (_wcsicmp(L"/m", szArgList[i]) == 0)
|
||||||
|
{
|
||||||
|
cmderOptions.cmderUserCfg = false;
|
||||||
|
}
|
||||||
|
else if (_wcsicmp(L"/register", szArgList[i]) == 0)
|
||||||
|
{
|
||||||
|
cmderOptions.registerApp = true;
|
||||||
|
cmderOptions.unRegisterApp = false;
|
||||||
|
if (szArgList[i + 1] != NULL)
|
||||||
|
{
|
||||||
|
if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0)
|
||||||
|
{
|
||||||
|
cmderOptions.cmderRegScope = szArgList[i + 1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_wcsicmp(L"/unregister", szArgList[i]) == 0)
|
||||||
|
{
|
||||||
|
cmderOptions.unRegisterApp = true;
|
||||||
|
cmderOptions.registerApp = false;
|
||||||
|
if (szArgList[i + 1] != NULL)
|
||||||
|
{
|
||||||
|
if (_wcsicmp(L"all", szArgList[i + 1]) == 0 || _wcsicmp(L"user", szArgList[i + 1]) == 0)
|
||||||
|
{
|
||||||
|
cmderOptions.cmderRegScope = szArgList[i + 1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cmderOptions.cmderStart == L"")
|
||||||
|
{
|
||||||
|
int len = wcslen(szArgList[i]);
|
||||||
|
if (wcscmp(&szArgList[i][len - 1], L"\"") == 0)
|
||||||
|
{
|
||||||
|
szArgList[i][len - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PathFileExists(szArgList[i]))
|
||||||
|
{
|
||||||
|
cmderOptions.cmderStart = szArgList[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
|
||||||
|
cmderOptions.error = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox(NULL, szArgList[i], L"Folder does not exist!", MB_OK);
|
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
|
||||||
|
cmderOptions.error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
|
|
||||||
cmderOptions.error = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalFree(szArgList);
|
LocalFree(szArgList);
|
||||||
@ -572,8 +656,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
|
|
||||||
if (cmderOptions.registerApp == true)
|
if (cmderOptions.registerApp == true)
|
||||||
{
|
{
|
||||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND);
|
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot);
|
||||||
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM);
|
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot);
|
||||||
}
|
}
|
||||||
else if (cmderOptions.unRegisterApp == true)
|
else if (cmderOptions.unRegisterApp == true)
|
||||||
{
|
{
|
||||||
@ -586,7 +670,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot);
|
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
8
vendor/bin/alias.cmd
vendored
8
vendor/bin/alias.cmd
vendored
@ -40,7 +40,7 @@ goto parseargument
|
|||||||
) else if "%currentarg%" neq "" (
|
) else if "%currentarg%" neq "" (
|
||||||
if "%~2" equ "" (
|
if "%~2" equ "" (
|
||||||
:: Show the specified alias
|
:: Show the specified alias
|
||||||
doskey /macros | findstr /b %currentarg%= && exit /b
|
doskey /macros | %WINDIR%\System32\findstr /b %currentarg%= && exit /b
|
||||||
echo insufficient parameters.
|
echo insufficient parameters.
|
||||||
goto :p_help
|
goto :p_help
|
||||||
) else (
|
) else (
|
||||||
@ -85,7 +85,7 @@ if not ["%_temp%"] == ["%alias_name%"] (
|
|||||||
)
|
)
|
||||||
|
|
||||||
:: replace already defined alias
|
:: replace already defined alias
|
||||||
findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp"
|
%WINDIR%\System32\findstr /b /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp"
|
||||||
echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
|
echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
|
||||||
doskey /macrofile="%ALIASES%"
|
doskey /macrofile="%ALIASES%"
|
||||||
endlocal
|
endlocal
|
||||||
@ -93,7 +93,7 @@ exit /b
|
|||||||
|
|
||||||
:p_del
|
:p_del
|
||||||
set del_alias=%~1
|
set del_alias=%~1
|
||||||
findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp"
|
%WINDIR%\System32\findstr /b /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp"
|
||||||
type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
|
type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
|
||||||
doskey %del_alias%=
|
doskey %del_alias%=
|
||||||
doskey /macrofile="%ALIASES%"
|
doskey /macrofile="%ALIASES%"
|
||||||
@ -105,7 +105,7 @@ echo Aliases reloaded
|
|||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:p_show
|
:p_show
|
||||||
doskey /macros|findstr /v /r "^;=" | sort
|
doskey /macros|%WINDIR%\System32\findstr /v /r "^;=" | sort
|
||||||
exit /b
|
exit /b
|
||||||
|
|
||||||
:p_help
|
:p_help
|
||||||
|
2
vendor/bin/cexec.cmd
vendored
2
vendor/bin/cexec.cmd
vendored
@ -52,7 +52,7 @@ set "feFlagName=%feFlagName% "
|
|||||||
:: echo %feCommand%
|
:: echo %feCommand%
|
||||||
:: echo %feParam%
|
:: echo %feParam%
|
||||||
:: echo.
|
:: echo.
|
||||||
echo %CMDER_USER_FLAGS% | find /i "%feFlagName%">nul
|
echo %CMDER_USER_FLAGS% | %WINDIR%\System32\find /i "%feFlagName%">nul
|
||||||
if "%ERRORLEVEL%" == "0" (
|
if "%ERRORLEVEL%" == "0" (
|
||||||
if "%feNOT%" == "false" (
|
if "%feNOT%" == "false" (
|
||||||
endlocal && call %feCommand% %feParam%
|
endlocal && call %feCommand% %feParam%
|
||||||
|
21
vendor/init.bat
vendored
21
vendor/init.bat
vendored
@ -1,6 +1,6 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
set cmder_init_start=%time%
|
set CMDER_INIT_START=%time%
|
||||||
|
|
||||||
:: Init Script for cmd.exe
|
:: Init Script for cmd.exe
|
||||||
:: Created as part of cmder project
|
:: Created as part of cmder project
|
||||||
@ -244,8 +244,15 @@ if defined GIT_INSTALL_ROOT (
|
|||||||
:: define SVN_SSH so we can use git svn with ssh svn repositories
|
:: define SVN_SSH so we can use git svn with ssh svn repositories
|
||||||
if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
|
if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
|
||||||
|
|
||||||
for /F "delims=" %%F in ('env /usr/bin/locale -uU 2') do (
|
if not defined LANG (
|
||||||
set "LANG=%%F"
|
:: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path.
|
||||||
|
if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\locale.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\locale.exe"
|
||||||
|
if not defined git_locale for /F "delims=" %%F in ('where locale.exe 2^>nul') do (if not defined git_locale set git_locale="%%F")
|
||||||
|
if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\env.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\env.exe" /usr/bin/locale
|
||||||
|
if not defined git_locale set git_locale=env /usr/bin/locale
|
||||||
|
for /F "delims=" %%F in ('!git_locale! -uU 2') do (
|
||||||
|
set "LANG=%%F"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -300,7 +307,7 @@ if "%CMDER_ALIASES%" == "1" (
|
|||||||
echo Creating initial user_aliases store in "%user_aliases%"...
|
echo Creating initial user_aliases store in "%user_aliases%"...
|
||||||
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
|
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.example" "%user_aliases%"
|
||||||
) else (
|
) else (
|
||||||
type "%user_aliases%" | findstr /i ";= Add aliases below here" >nul
|
type "%user_aliases%" | %WINDIR%\System32\findstr /i ";= Add aliases below here" >nul
|
||||||
if "!errorlevel!" == "1" (
|
if "!errorlevel!" == "1" (
|
||||||
echo Creating initial user_aliases store in "%user_aliases%"...
|
echo Creating initial user_aliases store in "%user_aliases%"...
|
||||||
if defined CMDER_USER_CONFIG (
|
if defined CMDER_USER_CONFIG (
|
||||||
@ -346,6 +353,7 @@ if not defined HOME set "HOME=%USERPROFILE%"
|
|||||||
set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd"
|
set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd"
|
||||||
if exist "%CMDER_ROOT%\config\user_profile.cmd" (
|
if exist "%CMDER_ROOT%\config\user_profile.cmd" (
|
||||||
REM Create this file and place your own command in there
|
REM Create this file and place your own command in there
|
||||||
|
%lib_console% debug_output init.bat "Calling - %CMDER_ROOT%\config\user_profile.cmd"
|
||||||
call "%CMDER_ROOT%\config\user_profile.cmd"
|
call "%CMDER_ROOT%\config\user_profile.cmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -353,6 +361,7 @@ if defined CMDER_USER_CONFIG (
|
|||||||
set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd"
|
set "initialConfig=%CMDER_USER_CONFIG%\user_profile.cmd"
|
||||||
if exist "%CMDER_USER_CONFIG%\user_profile.cmd" (
|
if exist "%CMDER_USER_CONFIG%\user_profile.cmd" (
|
||||||
REM Create this file and place your own command in there
|
REM Create this file and place your own command in there
|
||||||
|
%lib_console% debug_output init.bat "Calling - %CMDER_USER_CONFIG%\user_profile.cmd
|
||||||
call "%CMDER_USER_CONFIG%\user_profile.cmd"
|
call "%CMDER_USER_CONFIG%\user_profile.cmd"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -398,9 +407,9 @@ if "%CMDER_ALIASES%" == "1" if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMD
|
|||||||
set initialConfig=
|
set initialConfig=
|
||||||
set CMDER_CONFIGURED=1
|
set CMDER_CONFIGURED=1
|
||||||
|
|
||||||
set cmder_init_end=%time%
|
set CMDER_INIT_END=%time%
|
||||||
|
|
||||||
if %time_init% gtr 0 (
|
if %time_init% gtr 0 (
|
||||||
%cmder_root%\vendor\bin\timer.cmd %cmder_init_start% %cmder_init_end%
|
"%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END%
|
||||||
)
|
)
|
||||||
exit /b
|
exit /b
|
||||||
|
8
vendor/lib/lib_base.cmd
vendored
8
vendor/lib/lib_base.cmd
vendored
@ -27,7 +27,7 @@ exit /b
|
|||||||
::: file <in> full path to file containing lib_routines to display
|
::: file <in> full path to file containing lib_routines to display
|
||||||
:::.
|
:::.
|
||||||
:::-------------------------------------------------------------------------------
|
:::-------------------------------------------------------------------------------
|
||||||
for /f "tokens=* delims=:" %%a in ('type "%~1" ^| findstr /i /r "^:::"') do (
|
for /f "tokens=* delims=:" %%a in ('type "%~1" ^| %WINDIR%\System32\findstr /i /r "^:::"') do (
|
||||||
rem echo a="%%a"
|
rem echo a="%%a"
|
||||||
|
|
||||||
if "%%a"=="." (
|
if "%%a"=="." (
|
||||||
@ -61,9 +61,9 @@ exit /b
|
|||||||
::: file <in> full path to file containing lib_routines to display
|
::: file <in> full path to file containing lib_routines to display
|
||||||
:::.
|
:::.
|
||||||
:::-------------------------------------------------------------------------------
|
:::-------------------------------------------------------------------------------
|
||||||
echo %comspec% | find /i "\cmd.exe" > nul && set "CMDER_SHELL=cmd"
|
echo %comspec% | %WINDIR%\System32\find /i "\cmd.exe" > nul && set "CMDER_SHELL=cmd"
|
||||||
echo %comspec% | find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc"
|
echo %comspec% | %WINDIR%\System32\find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc"
|
||||||
echo %comspec% | find /i "\tccle" > nul && set "CMDER_SHELL=tccle"
|
echo %comspec% | %WINDIR%\System32\find /i "\tccle" > nul && set "CMDER_SHELL=tccle"
|
||||||
|
|
||||||
set CMDER_CLINK=1
|
set CMDER_CLINK=1
|
||||||
if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0
|
if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0
|
||||||
|
4
vendor/lib/lib_path.cmd
vendored
4
vendor/lib/lib_path.cmd
vendored
@ -68,14 +68,14 @@ exit /b
|
|||||||
|
|
||||||
if "%CMDER_CONFIGURED%" == "1" (
|
if "%CMDER_CONFIGURED%" == "1" (
|
||||||
%lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%"
|
%lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%"
|
||||||
echo "%path%"|findstr >nul /I /R ";%find_query%\"$"
|
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R ";%find_query%\"$"
|
||||||
if "!ERRORLEVEL!" == "0" set found=1
|
if "!ERRORLEVEL!" == "0" set found=1
|
||||||
)
|
)
|
||||||
%lib_console% debug_output :enhance_path "Env Var 1 - found=!found!"
|
%lib_console% debug_output :enhance_path "Env Var 1 - found=!found!"
|
||||||
|
|
||||||
if "!found!" == "0" (
|
if "!found!" == "0" (
|
||||||
if "%CMDER_CONFIGURED%" == "1" (
|
if "%CMDER_CONFIGURED%" == "1" (
|
||||||
echo "%path%"|findstr >nul /i /r ";%find_query%;"
|
echo "%path%"|%WINDIR%\System32\findstr >nul /i /r ";%find_query%;"
|
||||||
if "!ERRORLEVEL!" == "0" set found=1
|
if "!ERRORLEVEL!" == "0" set found=1
|
||||||
)
|
)
|
||||||
%lib_console% debug_output :enhance_path "Env Var 2 - found=!found!"
|
%lib_console% debug_output :enhance_path "Env Var 2 - found=!found!"
|
||||||
|
18
vendor/profile.ps1
vendored
18
vendor/profile.ps1
vendored
@ -128,20 +128,30 @@ if (-not (test-path "$ENV:CMDER_ROOT\config\profile.d")) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pushd $ENV:CMDER_ROOT\config\profile.d
|
pushd $ENV:CMDER_ROOT\config\profile.d
|
||||||
foreach ($x in Get-ChildItem *.ps1) {
|
foreach ($x in Get-ChildItem *.psm1) {
|
||||||
# write-host write-host Sourcing $x
|
# write-host write-host Sourcing $x
|
||||||
Import-Module $x
|
Import-Module $x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($x in Get-ChildItem *.ps1) {
|
||||||
|
# write-host write-host Sourcing $x
|
||||||
|
. $x
|
||||||
|
}
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# Drop *.ps1 files into "$ENV:CMDER_USER_CONFIG\config\profile.d"
|
# Drop *.ps1 files into "$ENV:CMDER_USER_CONFIG\config\profile.d"
|
||||||
# to source them at startup. Requires using cmder.exe /C [cmder_user_root_path] argument
|
# to source them at startup. Requires using cmder.exe /C [cmder_user_root_path] argument
|
||||||
if ($ENV:CMDER_USER_CONFIG -ne "" -and (test-path "$ENV:CMDER_USER_CONFIG\profile.d")) {
|
if ($ENV:CMDER_USER_CONFIG -ne "" -and (test-path "$ENV:CMDER_USER_CONFIG\profile.d")) {
|
||||||
pushd $ENV:CMDER_USER_CONFIG\profile.d
|
pushd $ENV:CMDER_USER_CONFIG\profile.d
|
||||||
foreach ($x in Get-ChildItem *.ps1) {
|
foreach ($x in Get-ChildItem *.psm1) {
|
||||||
# write-host write-host Sourcing $x
|
# write-host write-host Sourcing $x
|
||||||
Import-Module $x
|
Import-Module $x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($x in Get-ChildItem *.ps1) {
|
||||||
|
# write-host write-host Sourcing $x
|
||||||
|
. $x
|
||||||
|
}
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +163,7 @@ if (test-path "$env:CMDER_ROOT\config\user-profile.ps1") {
|
|||||||
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user_profile.ps1"
|
$CmderUserProfilePath = Join-Path $env:CMDER_ROOT "config\user_profile.ps1"
|
||||||
if (Test-Path $CmderUserProfilePath) {
|
if (Test-Path $CmderUserProfilePath) {
|
||||||
# Create this file and place your own command in there.
|
# Create this file and place your own command in there.
|
||||||
Import-Module "$CmderUserProfilePath"
|
. "$CmderUserProfilePath" # user_profile.ps1 is not a module DO NOT USE import-module
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ENV:CMDER_USER_CONFIG) {
|
if ($ENV:CMDER_USER_CONFIG) {
|
||||||
@ -166,7 +176,7 @@ if ($ENV:CMDER_USER_CONFIG) {
|
|||||||
|
|
||||||
$CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user_profile.ps1"
|
$CmderUserProfilePath = Join-Path $ENV:CMDER_USER_CONFIG "user_profile.ps1"
|
||||||
if (Test-Path $CmderUserProfilePath) {
|
if (Test-Path $CmderUserProfilePath) {
|
||||||
Import-Module "$CmderUserProfilePath"
|
. "$CmderUserProfilePath" # user_profile.ps1 is not a module DO NOT USE import-module
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user