How can I have a .bat file write to a .txt file when ran through Scripts?

I have a clunky installer that will only run when a user is logged in. I am looking for a way to track this through a .txt log file.

This is the command being ran that I am not getting output for: 

ECHO %Date%,%time%,%computername%,%username%,Before - %VERIFYFILEEXISTS%,After - %AFTERVERIFYFILEEXISTS%>>"C:\IS\Logs\Log.txt"

The Log.txt file already exists on the workstation. Ideally I would want this stored on the network, but for now I just want to try and get it working locally so I know it isn't a permissions issue. 

0 Comments   [ + ] Show comments

Answers (1)

Posted by: chucksteel 1 year ago
Red Belt

If your script is running as system (the default option), then your %username% isn't going to work (unless you are setting it previously).

Can you use a managed install instead of a script to deploy the software? If so, then you can set the option to only install when a user is logged into the computer.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ