Need an easy way to create a unique file name with the date?


I needed to dump winlogon and do some checks against the dump file and needed and easy way to get the computername and date in the file name and formatted so I could easily perfrom next steps.  Here was the soution:

C:\Debuggers>echo %computername%_%DATE:~10,4%.%DATE:~4,2%.%DATE:~7,2%

Here was the script I was running to do some checks and get a dump of winlogon...

c:\debuggers\tlist -v |findstr /c:" 0 " |findstr "winlogon.exe" > c:\tlist.txt

for /f "tokens=3" %%a in (c:\tlist.txt) do SET PID=%%a

echo %PID%

C:\debuggers\cdb -p %PID% -pvr -c ".dump /ma C:\debuggers\%computername%_%DATE:~10,4%.%DATE:~4,2%.%DATE:~7,2%_winlogon.dmp;qd" //Noninvasive attach to the process (pvr) gets userdump and quits.

del /f c:\tlist.txt

Comments (0)

Skip to main content