cmd.exe: Save initial working directory.
This commit is contained in:
parent
9e041c6bc9
commit
d0db751e0c
|
@ -60,6 +60,7 @@ static char *WCMD_expand_envvar(char *start);
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char string[1024];
|
char string[1024];
|
||||||
|
char envvar[4];
|
||||||
char* cmd=NULL;
|
char* cmd=NULL;
|
||||||
DWORD count;
|
DWORD count;
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
|
@ -327,6 +328,13 @@ int main (int argc, char *argv[])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Save cwd into appropriate env var */
|
||||||
|
GetCurrentDirectory(1024, string);
|
||||||
|
if (IsCharAlpha(string[0]) && string[1] == ':') {
|
||||||
|
sprintf(envvar, "=%c:", string[0]);
|
||||||
|
SetEnvironmentVariable(envvar, string);
|
||||||
|
}
|
||||||
|
|
||||||
if (opt_k) {
|
if (opt_k) {
|
||||||
WCMD_process_command(cmd);
|
WCMD_process_command(cmd);
|
||||||
HeapFree(GetProcessHeap(), 0, cmd);
|
HeapFree(GetProcessHeap(), 0, cmd);
|
||||||
|
|
Loading…
Reference in New Issue