I am absolutely new to Batch and my manager needs me to do this by end of the day, any help will be great.
In my below code, I am trying to read a CSV file which has a list of stores and corresponding IP addresses. I have written this code to read every IP address and add the IP in my path to get the last modified date of the specific .truststore file.
SET csvfile=C:\***\***\**\ip.csv
FOR /F "tokens=1-2* delims=," %%A in (%csvfile%)
do (
rem if "%%~A" == "13" echo %%~B
SET store_num=%%~A
SET path1=%%~B & SET filename=\\%path1%\c$\***\***\**\*.truststore
net use X: %filename% /user:someuser password:password
FOR %%f IN (%filename%) DO SET filedatetime=%%~tf
IF "%filedatetime:~0,-9%" == "05/01/2015" GOTO END
echo %%A %%B %filedatetime% >> test.log )
-Somehow my filename always has the last IP address as the "path1" therefore it does not go to the other store's servers paths
-My last modified date is coming as empty(it was coming fine when I was doing for only one IP address and putting it manually)
-I am trying to match my last modified date and I found this way of removing the time so I did this:
IF "%filedatetime:~0,-9%" == "05/01/2015" GOTO END
What I am expecting as my result is: Store_num IP address Last Modified date
of only those stores whose .truststore file's last modified date is not 05/01/2015
Any help will be highly valuable.
Thank you!