New
#1
Batch programming; Script writes to a file which writes to a file
I have a script I run when reinstalling Windows. It creates a script called login.cmd which is executed via task manager when the user logs in.
Since the primary script writes the login.cmd file based on the users preferences and custom installation it is different for each user. That part is fine.
What I'm trying to accomplish is the have the login.cmd script write log file entries so I can debug the login.cmd and track its execution.
This will write a command to login.cmd
.Code:Echo IF EXIST C:\ABC\XYZ\*.tmp DEL C:\ABC\XYZ\*.tmp /f/s >>C:\TOOL\LOGIN.CMD
But what I want to have in the login.cmd is
I can't write this in the initial script;Code:IF EXIST C:\ABC\XYZ\*.tmp DEL C:\ABC\XYZ\*.tmp /f/s >>%LOCALAPPDATA%\Temp\Login.log 2>&1
as it crashes the script.Code:Echo IF EXIST C:\ABC\XYZ\*.tmp DEL C:\ABC\XYZ\*.tmp /f/s >>%LOCALAPPDATA%\Temp\Login.log 2>&1 >>C:\TOOL\LOGIN.CMD
How to I get the log file redirect into the login.cmd using the echo statement in the primary script?