I am trying to write one batch file from another, using echo. However, there is one line with special characters that I cannot work out how to write.
I have
The special characters need to be escaped with ^ and % signs have to be doubled. Try this:
The ( directly after echo stops issues with some leading characters.
echo(^>nul 2^>^&1 "%%SYSTEMROOT%%\system32\cacls.exe" "%%SYSTEMROOT%%\system32\config\system" >> "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\OrchestrationCleanUp.bat"