From 4fedfe1bf7dc124258be3a23d458c68cdb0a0205 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Thu, 7 Jul 2005 13:43:03 +0000 Subject: [PATCH] add %time% and %cd% internal value. Example echo %cd% or echo %time%. svn path=/trunk/; revision=16483 --- reactos/subsys/system/cmd/cmd.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/reactos/subsys/system/cmd/cmd.c b/reactos/subsys/system/cmd/cmd.c index dde407d6890..4cf49651b58 100644 --- a/reactos/subsys/system/cmd/cmd.c +++ b/reactos/subsys/system/cmd/cmd.c @@ -993,8 +993,22 @@ ProcessInput (BOOL bFlag) evar = malloc ( size * sizeof(TCHAR)); if (evar==NULL) return 1; - - if (_tcsicmp(ip,_T("errorlevel")) ==0) + + if (_tcsicmp(ip,_T("cd")) ==0) + { + TCHAR szPath[MAX_PATH]; + GetCurrentDirectory (MAX_PATH, szPath); + cp = _stpcpy (cp, szPath); + } + + else if (_tcsicmp(ip,_T("time")) ==0) + { + TCHAR szTime[40]; + GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL, szTime, sizeof(szTime)); + cp = _stpcpy (cp, szTime); + } + + else if (_tcsicmp(ip,_T("errorlevel")) ==0) { memset(evar,0,512 * sizeof(TCHAR)); _itot(nErrorLevel,evar,10);