@ Humphrey For the write to file method you mentioned, is there a way to set a stop point, where it stops writing. The line now will write all beneath ::StartOf.
Makes no problems, when text to write is at the end of script, but would be nice to stop at certain point .
No you need to change one of the lines, the last one in green to: Code: echo schtasks /create /tn "Key" /tr "%%SystemDrive%%\IR7.bat" /sc onlogon /ru "" ^>nul>>%SystemDrive%\Trial\IR7\IR7.bat @s1ave77There is no way to provide a stop point with that method, however I see no reason why that portion cannot be placed directly at the bottom of the script after the final exit.
~ED~ BACK @s1ave77: See what you can do with this. Code: @ECHO OFF ECHO.Creating HoldingFile.CMD REM Jumps to the 12th line from the 4th line. for /f "delims=[]" %%a in ('find /n "::StartOf"^<"%~f0"') do more +%%a "%~f0" 1>HoldingFile.cmd REM After Holdingfile.cmd is created the batch returns to here and continues the rest of the script. PAUSE ECHO.CALLING HoldingFIle.CMD START HoldingFile.cmd ECHO.Outputting HELLO to text file. ECHO.HELLO >>Output.txt REM Batch file ends here. PAUSE & EXIT REM Batch jumps to here from the top line to create holdingfile.cmd. ::StartOf @ECHO OFF IF EXIST Output.txt echo.-----Found Output.txt. & PAUSE >NUL
Not sure if you tried that, but when code is written twice, only one escape is needed for second write command and two for all stuff to be written. Original code is correct .
I thought it was too many escapes but at least he's gotta a better understanding of nested writes the way we do it I think the general idea is out there now regarding how I want the design for the .bat msg to go @Compo I was thinking that you might be right about when to delete InstallingIR7.bat and it's InstallingIR7 task I forgot that my task runs at logon and the InstallingIR7 task will run again after restart and the task also runs InstallingIR7.bat silent which explains why it isn't showing up during reinstall ...lol Here is better task to use to run InstallingIR7.bat that has "Installing IR7..." msg Code: schtasks /create /tn "InstallingIR7" /tr "%SystemDrive%\Trial\InstallingIR7.bat" /sc onlogon /rl highest /f >nul Then we should delete InstallingIR7.bat and it's task before restart regarding reinstallation Otherwise my last post with the red/green colors is the RW to go with writing this last code for .bat msg
Ok testing and need the two ping cmds to write with Code: >nul cmd in C:\Trial\InstallingIR7.bat Code: echo schtasks /create /tn "InstallingIR7" /tr "%SystemDrive%\Trial\InstallingIR7.bat" /sc onlogon /rl highest /f ^>nul >>%SystemDrive%\Trial\IR7\IR7.bat echo echo @echo off^>^>%%systemdrive%%\Trial\InstallingIR7.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo title IR7^>^>%%systemdrive%%\Trial\InstallingIR7.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo mode con: cols=42 lines=2 ^>^>%%systemdrive%%\Trial\InstallingIR7.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo echo Installing IR7... ^>^>%%systemdrive%%\Trial\InstallingIR7.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo ping -n 90 127.0.0.1 ^>nul ^>^>%%systemdrive%%\Trial\InstallingIR7.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo echo Windows is restarting now... ^>^>%%systemdrive%%\Trial\InstallingIR7.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo ping -n 10 127.0.0.1 ^>nul ^>^>%%systemdrive%%\Trial\InstallingIR7.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo schtasks /delete /tn "InstallingIR7" /f^>^>%%systemdrive%%\Trial\InstallingIR7.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo del /F /Q %SystemDrive%\Trial\InstallingIR7.bat ^>nul^>^>%%systemdrive%%\Trial\InstallingIR7.bat>>%SystemDrive%\Trial\IR7\IR7.bat To test just create an Trial folder with IR7 folder inside it
Well I would suggest you do something about that code then! All it does is changes the color to whatever is set by default, I think you may need to set the color to a variable first.
This is the color code from the top of the script. Not sure how else to write the color script, this works but I am sure there is a better way. Went a head and added the key and value into its script instead of having a variable. Not like its used again anywhere else. Code: for /F "usebackq tokens=2 delims=x" %%A IN (`reg query "HKCU\Software\Microsoft\Command Processor" /v "DefaultColor" 2^>nul ^| find "DefaultColor"`) do ( IF /I %%A EQU 0x0 (Color %%A) ELSE (SET CLR=Color %%A) ) put %CLR% where you want the color. Code: :mainmenu %clr% set userinp= mode con: cols=50 lines=11 Could also SETX CLR=COLOR %%A to set it environmentally. Code: echo echo @echo off^>^>%%systemdrive%%\Trial\Msgbox.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo title IR7^>^>%%systemdrive%%\Trial\Msgbox.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo %CLR%^>^>%%systemdrive%%\Trial\Msgbox.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo mode con: cols=42 lines=2 ^>^>%%systemdrive%%\Trial\Msgbox.bat>>%SystemDrive%\Trial\IR7\IR7.bat echo echo echo Installing IR7... ^>^>%%systemdrive%%\Trial\Msgbox.bat>>%SystemDrive%\Trial\IR7\IR7.bat