Link to home
Start Free TrialLog in
Avatar of TheITGuy
TheITGuy

asked on

Need to Print Script Output to a Log

I know this is somewhat basic but I cannot get this script to print to a log and it is driving me nuts.  It doesnt fail it just sits on the printing part for a very long time and then finally goes past without error only nothing shows up on my file.  What the script is doing is looking at pip files to spit out the last access date so we can find out if users are actually using their products.  I do not know if this is going to append or replace the file so i will need to address that as well but right now it does not print the script output at all.  I want it to print the entire dos window complete as I also have it spitting out the machine name so we will know what we are looking at in the log.  Any suggestions on why it will not print. I have admin rights on the test machine and it still does not want to write to the file.
cd\
cd documents*
 
net user
 
dir *.pip /S /T:A
 
PRINT c:\lag\project.log

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of TheITGuy
TheITGuy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To clarify for people who find this you can redirect output usin the > symbol to a file (or >> to append)

So in this example something like the below was probaly user to create or overwrite the log file when run.

dir *.pip /S /T:A > c:\lag\project.log
Avatar of TheITGuy
TheITGuy

ASKER

Here is what I ended up with.  Sorry.. I should have clarified.


c:
cd\
cd documents*
 
Set Logfile=\\dts19\smssour\msprojcomp\log\%computername%.log
 
net user>>%logfile%
 
dir *.pip /S /T:A>>%logfile%
 
exit

Open in new window