Command line for general logging via batch file

Profit maintains a log file while running a batch file if you entered this in the command line. Profit only logs errors in this file. You can maintain a simple log file that saves a line before and after running the batch file.

In the following example, you will use a command line to generate a report and save it as a PDF file.

Example:

date /t=%date%

time /t=%time%

ECHO Start report.bat on %date% %time% >> "C:\AFAS_cmd.log"

"C:\Program files (x86)\Profit\AFAS Windows\Kernel\Bin\AFASCMD.EXE" /O"H11_PVS9" /G"Extern" /W"2011!Pwd" /L"C:\AFAS_cmd.log" REPORT /R"EC79689544E07C3D9B6F25965AC5FA9F" /F"C:\Employees.pdf"

ECHO End report.bat on %date% %time% >> "C:\AFAS_cmd.log"

ECHO end %date% %time% report.bat

ECHO

If the command line is successful, Profit will only save lines with the date and time (these are found behind the ECHO statement).

Example:

Start report.bat on Tue 13-09-2011 9:09:59,14

End report.bat on Tue 13-09-2011 9:10:00,66

If the command line fails (for example, because the ID of the report is incorrect), Profit will log this.

Example:

Start report.bat on Tue 13-09-2011 9:16:40,48

13-9-2011 9:16:41 You have insufficient rights to perform this report. (User is not authorised to use connector.)

Number...............: -2147200104 #80045398 [ANTA]

Description..........: User is not authorized to use connector.

Init state...........: Raised

Source...............: afascmd

Version..............: 8.200.1100

Location.............: C:\Program Files (x86)\Profit\AFAS Windows\Kernel\Bin

Source descr.........: Anta Command Line Tool (C)

Time.................: 13-09-2011 09:16:41.470

DLL/EXE file.........: C:\Program Files (x86)\Profit\AFAS Windows\Kernel\Bin\afascmd.exe [8.200.0.1100]

Session..............: AFASGROEP\PVS on AFASGROEP\PTKC11HB (TS)

---------------------

Landmark.............: AntaCommandLine.Report.ExecuteReport [72DE2528]

Landmark.............: AntaCommandLine.Report.GetReportOutput [3318278B]

PAR: parReportId.....: EC79689544E07C3D9B6F2595FA9F

---------------------

Landmark.............: AntaCommandLine.Report.StartReport [72DE2527]

---------------------

Landmark.............: CommandLineFunctions.Main [351028C2]

End report.bat on Tue 13-09-2011 9:16:41,50

Directly to

  1. Configuration of scheduled tasks
  2. Schedule regular tasks
  3. Scheduled tasks with more than one schedule
  4. Check for presence of batch file with IF EXIST
  5. Command line for general logging via batch file