0

is it possible to make output from whole :MENU2 label of a batch (from within a batch) into .txt?

:menu
     cls
     echo welcome
     echo label1 loading...
     timeout /t 9 > nul
     goto label1

:MENU2
     cls
     echo hello
     pause 
     goto :menu

:label2
     cls
     echo hello again
     ....

rem for :label1 > x.txt

something like "send :label1 > x.txt" where content of the x.txt will be:

:MENU2
     cls
     echo hello
     pause 
     goto :menu

(preferably batch-only solution)

  • This cries out for a Windows port of the Linux utility sed. – AFH May 25 '18 at 14:44
  • can you elaborate what did you mean? – user902300 May 25 '18 at 14:48
  • This tutorial will show you how useful sed is, including examples very easily adapted to your requirements. – AFH May 25 '18 at 15:25
  • @AFH can I use this on windows 7 cmd ? – user902300 May 25 '18 at 17:13
  • If you down-load the GNU port from Source Forge, you will see that it dates from 2010, when Windows 7 was current, so it should run without problem. It is a 32-bit build, so it should run on both 32- and 64-bit systems. – AFH May 25 '18 at 17:32

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.