Jump to content

Logging the batch processing


Recommended Posts

Doesn anyone know how to log the contents of the whole cmd-window while executing the .cmd file(s)?

So for example writing an install.log file where all error messages are sotred so you don't have to watch your computer while installing everything.

Link to comment
Share on other sites

  • 2 weeks later...

This is the only command I know of, and because of the way it works, you may have to define multiple filenames for each start/copy/del process you perform. (to prevent overwriting). The > C:\file.txt works on any DOS command, as long as its on the end of the command, examples:

start /wait blahblah\apps\zonealarm.exe /qn > c:\zonealarm.txt

del %systemrooot%\system32\uxtheme.dll > c:\uxtheme.txt

and so on. Let me know how it goes.

Link to comment
Share on other sites

when i tried user.cmd >"c:\setup.log" it kept on looping my code, why, and wherte in the batch do i put >blah blah

there must be a space inbetween > and C:\

You won't need the quotes if you specify a filename without spaces.

examples:

user.cmd > "c:\setup logs.log"

user.cmd > c:\setup.log

Link to comment
Share on other sites

If you use >> it will append to the file. > overwrites. That way you can have one log for all of your batches i.e.

main_batch.cmd >> c:\batches.txt

Hotfixes.cmd >> c:\batches.txt

Applications.cmd >> c:\batches.txt

Link to comment
Share on other sites

EDIT...

The code below does NOT work.

I have no idea why because if you ran it from a command prompt there would be no problems.

Putting it in the winnt.sif gives an error and stops the installation from running.

It seems as though normal cmd prompt options will not work with the winnt.sif

Anyone have any ideas about this?

Hmmm, what do you mean 'keeps calling itself'?

It sounds like you've put the main.cmd > c:\main.log line in the batch file - is that right? if so that's your error, you should place that in your winnt.sif i.e.

I haven't actually tried this yet but I think you should do this. I am going to try it myself right now and will report back in a couple of hours with my results.

Replace:

[GuiRunOnce]

%systemdrive%\software\main_batch.cmd

%systemdrive%\software\hotfixes.cmd

%systemdrive%\software\applications.cmd

With

[GuiRunOnce]

%systemdrive%\software\main_batch.cmd >> %systemdrive%\batches.txt

%systemdrive%\software\hotfixes.cmd >> %systemdrive%\batches.txt

%systemdrive%\software\applications.cmd >> %systemdrive%\batches.txt

It might also be worth removing @echo off just so you get more info.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...