I have a script that scans computers for a certain registry entry. I want to make it to where after the scan the text file that is created, to include the date and time of day as part of the filename (date from the local machine is ok). I have found some examples that seem to do this but either I don't understand their answer or they are not including it in the file name.
Please, if you give an answer to explain what each part is that allows the date to be in the file name. I have seen things about tokens and indices and I do not understand what those are but I am very new to scripting and am trying to learn about this.
Below is the code I have so far for my script.
@echo off
Setlocal
::Test Script
echo This script is used to find a registry setting.(Actual registry patch has been changed for use as an example)
set /p c= Input computer name and push enter:
set stamp=%date% at %time%
set DateTime=%stamp
call :screen
call :log
pause
:screen
echo.
echo Computer name: %c%
reg query "\\%c%\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Registry Folder\Registry Folder2\" /V "Registry Key" | FIND "Registry Key"
echo.
goto :eof
:log
echo.
echo Registry value for %c% on %stamp% >TextFile.txt
reg query "\\%c%\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Registry Folder\Registry Folder2\" /V "Registry Key" | FIND "Registry Key" >>TextFile.txt
echo.
goto :eof
As you can see I changed the actual registry key I was looking for. Honestly any command can be put there as I am focused on trying to find out how to make the text file that is being created have the correct timestamp within the file name.
Operating System: Windows XP and Windows 7 Note: Please excuse me not being able to give the exact name of the scripting language I am using as the only way I know how to refer to it is "Windows Command Line Script"... I don't even know if that is correct.