Writing special characters from one batch file to another

后端 未结 1 543
温柔的废话
温柔的废话 2021-01-24 11:09

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

相关标签:
1条回答
  • 2021-01-24 11:52

    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"
    
    0 讨论(0)
提交回复
热议问题