1

I have a script that install several programs.

I would like to write a series of batch scripts to log these installs.

I was hoping to find a command that would allow me to select this text file and write a line to the file each time it runs.

  • flash installs
  • batch file runs and logs text "flash installed" to c:\log\logfile.txt
  • java installs
  • batch file runs and writes text "java installed" to c:\log\logfile.txt
  • and so on

so that in log file when finished it has

flash installed
java installed
chrome installed
so on

so forth

However, I'm finding a lot of scripts for writing to specific lines or editing specific strings of text. I'm not seeing any scripting for just write to the next blank line. Perhaps I'm going about this the wrong way.

6

To append a line to a text file using a windows command line batch script you can use output redirection using the greater-than sign twice >>. For example

echo "java installed" >> c:\log\logfile.txt

Related:

  • You can also type 1>> for stdout, 2>> for stderr – juniorRubyist Sep 23 '15 at 5:55
-1

hey Im actually looking for an answer for something else at the moment and stumbled upon this so i just thought Id post a script I made at my last job

@echo off echo Flash Check

set KEY_NAMEFP=HklM\Software\macromedia\Flashplayer

set VALUE_NAMEFP=CurrentVersion

for /F "usebackq tokens=3" %%A IN (reg query "%KEY_NAMEFP%" /v "%VALUE_NAMEFP%" 2^>nul ^| find "%VALUE_NAMEFP%") do ( set A=%%A )

echo Flash %A%

echo Flash %A%>>%computername%.log

echo IE Check

set KEY_NAMEIE=HklM\Software\microsoft\internet explorer set VALUE_NAMEIE=svcVersion for /F "usebackq tokens=3" %%B IN (reg query "%KEY_NAMEIE%" /v "%VALUE_NAMEIE%" 2^>nul ^| find "%VALUE_NAMEIE%") do ( set B=%%B )

echo IE Version %B%

echo IE Version %B%>>%computername%.log

echo Java Check

set KEY_NAMEJ=HKLM\SOFTWARE\JavaSoft\Java Runtime Environment set VALUE_NAMEJ=CurrentVersion for /F "usebackq tokens=3" %%C IN (reg query "%KEY_NAMEJ%" /v "%VALUE_NAMEJ%" 2^>nul ^| find "%VALUE_NAMEJ%") do ( set C=%%C )

echo Java Version %C%

echo Java Version %C% >>%computername%.log

pause

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.