i'm new in batch programmation and it's been 8 hours i'm trying to figure how to resolve my problem. That's why i'm here, i'm sure I passed out of something ...
I have a command
@ECHO OFF
echo Demarre le %date:~0,8% a %time:~0,5% >> C:\TEMP\pointage.csv
which put in pointage.csv the date on PC start up (we will call it A)
I have another command
@Echo Off&SetLocal
For /F "UseBackQ Tokens=1-4" %%A In (
`Powershell "$OS=GWmi Win32_OperatingSystem;$UP=(Get-Date)-"^
"($OS.ConvertToDateTime($OS.LastBootUpTime));$DO='d='+$UP.Days+"^
"' h='+$UP.Hours+' n='+$UP.Minutes;Echo $DO"`) Do (
Set "%%A"&Set "%%B"&Set "%%C")
Echo Temps de fonctionnement: %d% jour, %h% heures, %n% minutes >> C:\TEMP\pointage.csv
Echo Eteint le %date:~0,8% a %time:~0,5% >> C:\TEMP\pointage.csv
which put in pointage.csv the date when PC is shutdown (call B) + the time that pass between launch and shutdown (call C)
The problem is :
A, B & C are located in A1 for A, A2 for B, A3 for C in my pointage.csv
I want to put :
Every A results on column A,
Every B results on column B,
Every C results on column C.
in my pointage.csv
How to do that ? I tried many things, for example creating 3 files.txt and put them A,B & C then trying to use for /F function. But I don't find anything which works a little bit.
Thank you for helping !