Forum Discussion
Surya2023
Jul 27, 2022Copper Contributor
SFC scan using Batch file or Powershell
Hi, Trying to run SFC scan every day using task scheduler ,however the result are storing in default location C:\Windows\Logs\CBS CBS text file , Written Batch file ,to run sfc scan and save the...
- Jul 28, 2022Yes, you can use the following
"$env:USERPROFILE\Desktop\$(get-date -Format "ddM-MM-yyyy--hh-mm-ss")"
-----------
If the answer help, Please click on Best Response and give a like 🙂
farismalaeb
Jul 27, 2022Steel Contributor
Yes
sure you can use the following as a FilePath
-FilePath "$env:USERPROFILE\Desktop\$(get-date -Format "DD-MM-yyyy").txt"
Surya2023
Jul 27, 2022Copper Contributor
farismalaeb : The output name is still not coming with date,month,year with time its not coming .
please screenshot .
It should come like sfc_report_date.month.year.timestamp
could you please assist me
- farismalaebJul 28, 2022Steel ContributorYes, it wont, My mistake.
the DD should be small letter
$(get-date -Format "dd-MM-yyyy")
the result looks like 28-07-2022- Surya2023Jul 28, 2022Copper Contributor
Thank you !
now it's working fine.One request i tried to print hours & mints also like below
$(get-date -Format "ddMMyyyy HH:mm:ss").txt"
but it is getting error , could you let me know how can i get output file with date month year hours and mints and seconds as well ,
it is possible to get the file like --> sfc_scanreport_28-07-2022-hours-mints-seconds
like that so that we can easily identify the file name .
- farismalaebJul 28, 2022Steel ContributorYes, you can use the following
"$env:USERPROFILE\Desktop\$(get-date -Format "ddM-MM-yyyy--hh-mm-ss")"
-----------
If the answer help, Please click on Best Response and give a like 🙂