Rearm Wizard - The Premier Rearm Solution for Windows 7 and Office 2013

Discussion in 'MDL Projects and Applications' started by timesurfer, Mar 27, 2013.

  1. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    @ 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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #1202 timesurfer, Mar 30, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
  3. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    #1203 Humphrey, Mar 30, 2014
    Last edited by a moderator: Apr 20, 2017
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    #1204 s1ave77, Mar 30, 2014
    Last edited by a moderator: Apr 20, 2017
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    #1205 Humphrey, Mar 30, 2014
    Last edited by a moderator: Apr 20, 2017
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    Makes no problems, when text to write is at the end of script, but would be nice to stop at certain point :g:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Compo

    Compo MDL Member

    Mar 29, 2011
    136
    106
    10
    #1207 Compo, Mar 30, 2014
    Last edited by a moderator: Apr 20, 2017
    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.
     
  8. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    #1208 Humphrey, Mar 30, 2014
    Last edited by a moderator: Apr 20, 2017
    ~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
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    Would be nice to do it several times in a script not only once ... :g:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #1210 timesurfer, Mar 31, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    I will put that in my code and test

    Thanks
     
  11. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #1211 timesurfer, Mar 31, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
  12. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    #1212 s1ave77, Mar 31, 2014
    Last edited by a moderator: Apr 20, 2017
    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 :g:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #1213 timesurfer, Mar 31, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    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 :suicide:...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
     
  14. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #1214 timesurfer, Mar 31, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
  15. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #1215 timesurfer, Mar 31, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    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 :shisha:
     
  16. Compo

    Compo MDL Member

    Mar 29, 2011
    136
    106
    10
    #1216 Compo, Mar 31, 2014
    Last edited by a moderator: Apr 20, 2017
  17. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #1217 timesurfer, Mar 31, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
  18. Compo

    Compo MDL Member

    Mar 29, 2011
    136
    106
    10
    #1218 Compo, Mar 31, 2014
    Last edited by a moderator: Apr 20, 2017
    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.
     
  19. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    #1219 Humphrey, Mar 31, 2014
    Last edited by a moderator: Apr 20, 2017
    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
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  20. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #1220 timesurfer, Apr 1, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)