0

OK, Basically I am echo'ing a line to a CSV comma delimited.

This is what is happening:

This is the output:

Computer1   Fri 08/04/2017  13:20   110 917 340 907
Computer2   Fri 08/04/2017  13:21   110 917 435 852
Computer3   Fri 08/04/2017  12:39   180 92  916 
Computer4   Fri 08/04/2017  12:35   232 353 720 

I want:

Computer1   Fri 08/04/2017  13:20   110 917 340 907
Computer2   Fri 08/04/2017  13:21   110 917 435 852
Computer3   Fri 08/04/2017  12:39       180 92  916 
Computer4   Fri 08/04/2017  12:35       232 353 720 

I want to lead with a comma for every 3rd right-justified character, so the values line up correctly.

I am getting size of folders to calculate current folder size, then again weekly to determine growth.

The part I am struggling with is this:

for /f "tokens=1-2 delims= " %%a in ('C:\du64.EXE -v -q -nobanner C:\Temp^|find "Size:"') do SET DISKSIZE=%%b
ECHO. "%DISKSIZE%" **

(This will give a value containing commas. ex 12,345,678,910)

ECHO. %COMPUTERNAME%,%DATE%,%TIME:~0,5%,%DISKSIZE%,%PROCESSOR_ARCHITECTURE%>> "C:\DUOutput.CSV"
curious
  • 1,504
  • 5
  • 18
  • 32
  • The `92` on the `Computer3` line should be right justified; it just looks wrong. What we need is an explanation as to how your 'want' code bears any relationship to the last line of code, because I cannot see it at all. – Compo Aug 04 '17 at 21:27

1 Answers1

1
 ...set "DISKSIZE=                      %%b"
 echo %disksize:~-15%

No idea why you're getting 92 in your data, nor what lead with a comma for every 3rd right-justified character means.

see set /?|more from the prompt for documentation. I've no idea how many spaces I put before %%b - so long as there is at least a string of 15, it should be OK.

Magoo
  • 77,302
  • 8
  • 62
  • 84