Either of these commands does work. But if I'm not totally blind there isn't any time or date output.
Are these performance counter translated
At least these object names are not translated for me.
Moderator: DosItHelp
Are these performance counter translated
aGerman wrote:@Squashman
Either of these commands does work. But if I'm not totally blind there isn't any time or date output.Are these performance counter translated
At least these object names are not translated for me.
Squashman wrote:aGerman wrote:@Squashman
Either of these commands does work. But if I'm not totally blind there isn't any time or date output.Are these performance counter translated
At least these object names are not translated for me.
Not from that specific LOGMAN option. I was just trying to find out if the GUID's are the same. Then we could use a different LOGMAN option using that GUID to get the date time output. Just wanted to know if the GUID's are the same for everyone regardless of language.
Code: Select all
>logman query providers {36C23E18-0E66-11D9-BBEB-505054503030}
Provider GUID
-------------------------------------------------------------------------------
Microsoft-Windows-Diagnostics-Networking {36C23E18-0E66-11D9-BBEB-505054503030}
Code: Select all
@echo off
setlocal
::check if windows is XP
if defined USERDOMAIN_roamingprofile (set "v=v4") else (set "v=")
set "mon="
for /f "skip=2 delims=," %%# in ('typeperf "\UDP%v%\*" -si 0 -sc 1') do (
if not defined mon (
for /f "tokens=1-7 delims=.:/ " %%a in (%%#) do (
set mon=%%a
set date=%%b
set year=%%c
set hour=%%d
set minute=%%e
set sec=%%f
set ms=%%g
)
)
)
echo %year%%mon%%date%
echo %hour%%minute%%sec%%ms%
endlocal
Code: Select all
H:\>NET TIME \\%ComputerName%
Current time at \\Squashputer is 10/23/2015 11:37:26 AM
Code: Select all
set "year="
for /f "tokens=1-6 delims=/: " %%a in ('robocopy "|" . /njh') do if not defined year (
set "year=%%a" & set "month=%%b" & set "day=%%c"
set "hour=%%d" & set "min=%%e" & set "sec=%%f"
)
echo %year%/%month%/%day% %hour%:%min%:%sec%
mcnd wrote:
The basic idea is to force an error in the robocopy command and parse the date and time of the error in the output.
Squashman wrote:Page3 viewtopic.php?p=29762#p29762
Squashman wrote:Robocopy is not native to XP
Squashman wrote: You also can just use ROBOCOPY. You don't need to force any error to it.
Code: Select all
C:\>robocopy
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Fri Oct 23 17:08:43 2015
Simple Usage :: ROBOCOPY source destination /MIR
source :: Source Directory (drive:\path or \\server\share\path).
destination :: Destination Dir (drive:\path or \\server\share\path).
/MIR :: Mirror a complete directory tree.
For more usage information run ROBOCOPY /?
**** /MIR can DELETE files as well as copy them !
C:\>robocopy |find "Started :"
Started : Fri Oct 23 17:08:55 2015
C:\>
mcnd wrote:I think I have not seen this used in this topic.Code: Select all
set "year="
for /f "tokens=1-6 delims=/: " %%a in ('robocopy "|" . /njh') do if not defined year (
set "year=%%a" & set "month=%%b" & set "day=%%c"
set "hour=%%d" & set "min=%%e" & set "sec=%%f"
)
echo %year%/%month%/%day% %hour%:%min%:%sec%
The basic idea is to force an error in the robocopy command and parse the date and time of the error in the output.
2015/10/24 01:35:53 ERROR 123 (0x0000007B) Accessing Source Directory C:\Users\..
The filename, directory name, or volume label syntax is incorrect.
Code: Select all
@echo off
setlocal enableExtensions enableDelayedExpansion
:: read format from registry
set "variables="iDate" "sDate" "sShortDate" "iTime" "iTimePrefix" "s1159" "s2359" "sTime" "sTimeFormat" "sDecimal""
for %%a in (%variables%) do set "%%~a="
for /F "tokens=1,3" %%a in ('reg query "HKCU\Control Panel\International" ^| findstr "%variables%"') do (
set "%%~a=%%~b"
set "variable.%%~a=true"
)
for %%a in (%variables%) do if defined variable.%%~a (
set "variables=!variables:"%%~a"=!"
set "variable.%%~a="
)
if not "!variables: =!" == "" for /F "tokens=1,3" %%a in ('reg query "HKU\.DEFAULT\Control Panel\International" ^| findstr "%variables%"') do (
set "%%~a=%%~b"
set "variable.%%~a="
)
if "!variables: =!" == "" ( set "variables="
) else echo(@todo: Error: %variables %
:: set date format
:: date[iDate]
set "date[0]=month%sDate%day%sDate%year"
set "date[1]=day%sDate%month%sDate%year"
set "date[2]=year%sDate%month%sDate%day"
for /F "tokens=1-6 delims=%sDate%" %%a in ("!date[%iDate%]!%sDate%%date%") do (
set "%%~a=%%~d"
set "%%~b=%%~e"
set "%%~c=%%~f"
)
for /L %%a in (0, 1, 2) do set "date[%%~a]="
:: set date format
:: time[iTime][iTimePrefix]
set "time[0][0]=hour%sTime%minute%sTime%:second%sDecimal%centisecond timeMarker"
set "time[0][1]=timeMarker hour%sTime%minute%sTime%:second%sDecimal%centisecond"
set "time[1][0]=hour%sTime%minute%sTime%:second%sDecimal%centisecond timeMarker"
set "time[1][1]=hour%sTime%minute%sTime%:second%sDecimal%centisecond timeMarker"
for /F "tokens=1-10 delims=%sTime%%sDecimal% " %%a in ("!time[%iTime%][%iTimePrefix%]! !time!") do (
set "%%~a=%%~f"
set "%%~b=%%~g"
set "%%~c=%%~h"
set "%%~d=%%~i"
set "%%~e=%%~j"
)
for /L %%a in (0, 1, 1) do for /L %%b in (0, 1, 1) do set "time[%%~a][%%~b]="
:: remove trailing zeroes
for %%a in ("year" "month" "day" "hour" "minute" "second" "centisecond") do (
set "%%~a=0000!%%~a!"
set /A "%%~a=1!%%~a:~-4!-10000"
)
:: convert to 24 if needed: actually not implemented
:: AM PM : h:m:s - hh:mm:ss .
:: s1159 s2359 sTime sTimeFormat sDecimal
:: if "%s1159%" == "%timeMarker%" if %hour%" == "12" set hour...
:: display some info
if "%iTime%" == "0" echo(clock : 12 hour
if "%iTime%" == "1" echo(clock : 24 hour
if "%iTimePrefix%" == "0" echo(time marker: suffix
if "%iTimePrefix%" == "1" echo(time marker: prefix
echo(
set year
set month
set day
set hour
set minute
set second
set centisecond
if defined timeMarker set timeMarker
endlocal
goto :eof
npocmaka_ wrote: ..., though the info header with day of the week is missing (one of good features of robocopy).
Code: Select all
set "year="
for /f "tokens=1-6 delims=/: " %%a in ('robocopy "|" . /njh') do if not defined year (
set "year=%%a" & set "month=%%b" & set "day=%%c"
set "hour=%%d" & set "min=%%e" & set "sec=%%f"
rem Zeller's congruence : https://en.wikipedia.org/wiki/Zeller's_congruence
if %%b lss 3 (set /a "y=%%a-1") else (set "y=%%a")
set /a "dow=((1%%c %% 100)+(13*((((1%%b %% 100)+9) %% 12 + 3)+1)/5)+(y %% 100)+(y %% 100)/4+(y/100)/4-2*(y/100)) %% 7"
rem Day correction from Zeller's output (0-Sat to 6-Fri) to ISO-8601 (1-Mon to 7-Sun)
set /a "dow=(dow+5)%%7+1"
)
echo %year%/%month%/%day% %hour%:%min%:%sec% %dow%
Code: Select all
C:\Users\Squashman>where /T cmd.exe
233984 10/30/2015 2:17:49 AM C:\WINDOWS\System32\cmd.exe