Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: [HELP]Output two values in batch log to .csv with headers  (Read 4085 times)

0 Members and 1 Guest are viewing this topic.

QuriouzOne

    Topic Starter


    Newbie

    • Experience: Familiar
    • OS: Windows 7
    [HELP]Output two values in batch log to .csv with headers
    « on: November 25, 2014, 12:07:25 AM »
    Greetings Everyone,

    To begin with, I extremely suck at doing batch scripting, so pardon my lack of understanding in this field.

    I am attempting to output certain values to a .CSV file, however, I am unable to to get them separated into 4 columns.

    Ideally, I would like to have the time-stamp of this activity logged onto another column of the CSV file as well.

    The output should look something like this:

    Column A
    Hostname
    TEST-PC01

    Column B
    Queried "START" value of "HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR" from registry

    Column C
    DATE
    DD/MM/YYYY

    Column D
    TIME
    14:00

    Below is what I have thus far :

    @echo off
    echo %computername%/%username% >>C:\reg_output.csv
    echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>>C:\reg_output.csv
    reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR" /v "Start">>C:\reg_output.csv
    echo>>C:\reg_output.csv

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: [HELP]Output two values in batch log to .csv with headers
    « Reply #1 on: November 25, 2014, 06:40:13 AM »
    Gather all your data into separate variables and then echo all of them at once to the CSV file.

    Code: [Select]
    Echo %computername%,%regquery%,%date%,%time% >>C:\reg_output.csv

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: [HELP]Output two values in batch log to .csv with headers
    « Reply #2 on: November 25, 2014, 08:25:03 AM »
    Also posted on TechGuy.org on November 17th.
    Foxidrive replied back that day but the OP did not respond back again until today.
    http://forums.techguy.org/dos-other/1137586-output-two-values-batch-log.html