Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: batch file logging windows 7 home how to question  (Read 15541 times)

0 Members and 1 Guest are viewing this topic.

snowcatman

    Topic Starter


    Beginner

    • Experience: Beginner
    • OS: Windows 8
    batch file logging windows 7 home how to question
    « on: March 08, 2014, 02:46:21 PM »
    I have windows 7 home. As admin I did a ver. in the cmd.exe, results were "Microsoft Windows [version 6.1.7601]"

    I am making a patch file that changes your logon wallpaper. What can I say. I want to learn how.

    The question is! How do I log whats going on it the patch file?

    Whats happening is a cmd window opens up and just sit's there doing nothing. The files output.txt and error.txt are made put there is nothing in them. Eventually I just x out of the window.

    Here is the code I am using so far. Or what mess I have made so far. Its a work in progress.  :)

    I am using "resource hacker [version 3.6.0.92] by angus johnson"
    i have a picture file that meets microsoft's requirments
    ==============================================================

    @ECHO OFF

    logonwallpaper.bat 1> output.txt 2> error.txt

    CLS

    ECHO You need to exit and start this
    ECHO file with administrator privileges.
    ECHO If you already have just countinue.
    ECHO Thank You
    echo.
    echo press anykey
    PAUSE > NUL

    :MENU
    CLS

    ECHO ============= MENU NAME =============
    ECHO -------------------------------------
    ECHO A. Read Me First
    ECHO -------------------------------------
    ECHO B  2.enable uac not yet emplemented
    ECHO -------------------------------------
    ECHO C  3.background wallper changer at logon
    ECHO -------------------------------------
    ECHO D  Selection 4
    ECHO -------------------------------------
    ECHO E  Selection 5
    ECHO -------------------------------------
    ECHO F  Selection 6
    ECHO -------------------------------------
    ECHO G  Selection 7
    ECHO -------------------------------------
    ECHO H  Selection 8
    ECHO -------------------------------------
    ECHO I  Selection 9
    ECHO -------------------------------------
    ECHO ==========PRESS 'z' TO QUIT==========
    ECHO.

    SET INPUT=
    SET /P INPUT=Please select a number:

    IF /I '%INPUT%'=='a' GOTO Selection1
    IF /I '%INPUT%'=='b' GOTO Selection2
    IF /I '%INPUT%'=='c' GOTO Selection3
    IF /I '%INPUT%'=='d' GOTO Selection4
    IF /I '%INPUT%'=='e' GOTO Selection5
    IF /I '%INPUT%'=='f' GOTO Selection6
    IF /I '%INPUT%'=='g' GOTO Selection7
    IF /I '%INPUT%'=='h' GOTO Selection8
    IF /I '%INPUT%'=='i' GOTO Selection9
    IF /I '%INPUT%'=='j' GOTO Selection9

    IF /I '%INPUT%'=='z' GOTO Quit

    CLS

    ECHO ============INVALID INPUT============
    ECHO -------------------------------------
    ECHO Please select a number from the Main
    echo Menu [1-9] or select 'z' to quit.
    ECHO -------------------------------------
    ECHO ======PRESS ANY KEY TO CONTINUE======

    PAUSE > NUL
    GOTO MENU

    :Selection1

    echo Ok this is to change your wallpaper on your login screen as if you were to do it manually.
    echo Even though we are doing it in a patch file.
    echo I am in the beginning stages of making this work. the reason i made the script the way i
    echo did is to see and know what i am doing with it. i need to see the errors and know if there needs to be a change.
    echo.
    echo the script is full of pauses and you need to tap on the enter key once or twice to see the script move on
    echo.
    echo if you see a drive letter the just type exit and the script will continue.
    echo.
    echo it may ask if you are making a folder or a file i choose file
    echo.
    echo it needs some touch up so don't nock it for what it is. think if you had
    echo to do it mannually in a batch file how would you do it.
    echo.
    echo also if you make any changes to these files please zip the folder back up and send it my way. thank you
    echo [email protected]
    echo.
    echo thank you.
    echo Press Any Key when done Reading!
    echo.
    PAUSE > NUL
    Goto Menu

    :Selection2

    cls


    echo press anykey
    PAUSE > NUL
    Goto Menu

    :Selection3

    cls

    echo before you begine this you need to
    echo be on the administrator account you unhide
    echo if you are not please use ctrl c and exit this batch script
    echo if you are on the administrator account then just press anykey
    PAUSE > NUL

    cls


    echo processing

    C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

    echo killing task's<----------
    taskkill /f /IM explorer.exe
    taskkill /f /IM rundll32.exe
    taskkill /f /IM procexp64.exe
    PAUSE > NUL
    cls

    SET __COMPAT_LAYER=WINXPSP3

    echo step 1 take ownership
    TAKEOWN /F %windir%\system32\imageres.dll
    ICACLS %windir%\system32\imageres.dll /GRANT Administrator:F

    echo step 2 make directory
    mkdir %~dp0\temp

    echo press anykey
    PAUSE > NUL
    cls

    echo step 3 copy file make old
    xcopy %windir%\system32\imageres.dll "%windir%\system32\imageres.dll.old" /c /y /h

    echo step 4 copy file to temp
    xcopy %windir%\system32\imageres.dll %~dp0\temp /c /y /h

    Echo step 5 delete file in system
    attrib -r -s -h "%windir%\system32\imageres.dll" | echo attrib used
    del /q /f "%windir%\system32\imageres.dll" | echo imageres.ddl deleted in the system folder

    PAUSE > NUL

    echo step 6 overwrite image to file
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5031,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo .
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5032,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ..
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5033,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ...
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5034,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ....
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5035,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo .....
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5036,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ......
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5037,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo .......
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5038,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ........
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5039,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ........."25%"
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5040,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ..........
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5041,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ...........
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5042,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ............
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5043,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo .............
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5044,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ..............
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5045,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ..............."50%"
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5046,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ................
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5047,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo .................
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5048,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ..................
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5049,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ...................
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5050,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ...................."75%"
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5051,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo .....................
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5052,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ......................
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5053,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo .......................
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5054,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ........................
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5055,
    xcopy %~dp0\temp\imageres1.dll %~dp0\temp\imageres.dll /c /y /h
    echo ........................
    %~dp0\ResHacker.exe -addoverwrite %~dp0\temp\imageres.dll, %~dp0\temp\imageres1.dll, %~dp0\cat.jpg, image, 5056,
    echo ........................."100%"




    echo step 7 copy modified file back to origanel location

    xcopy %~dp0\temp\imageres.dll %windir%\system32\imageres.dll /c /y

    PAUSE > NUL

    echo cleanup delete temp folder
    del /q %~dp0\temp | echo attemped delete of temp folder

    PAUSE > NUL

    @rem IF EXIST "%~dp0\temp\" ( del /q "%~dp0\temp\" | delete command used ) ELSE ( echo file or folder still exists )

    PAUSE > NUL

    start /b explorer.exe
    start /b rundll32.exe
    start /b procexp64.exe

    echo proccess finnished
    echo.
    echo press anykey
    PAUSE > NUL


    :Selection4

    and so on

    :Selection5

    and so on

    :Selection6

    and so on

    :Selection7

    and so on

    :Selection8

    and so on

    :Selection9

    and so on

    echo back to menu
    PUASE>NUL
    goto menu
    CLS

    :Quit
    cls

    ECHO ==============THANKYOU===============
    ECHO -------------------------------------
    ECHO ======PRESS ANY KEY TO CONTINUE======

    PAUSE>NUL
    EXIT

    ==============================================================

    thank you for checking it out.

    snowcatman

      Topic Starter


      Beginner

      • Experience: Beginner
      • OS: Windows 8
      Re: batch file logging windows 7 home how to question
      « Reply #1 on: March 08, 2014, 04:07:09 PM »
      I know i am replying to my own post put was thinking i have a template script and it seem to not work out either. put it doesn't freeze up. i get the log.log but nothing is in it. i was thinking i should see something. right?


      ==============================================================

      @ECHO OFF

      defualt batch script.bat>>log.log

      CLS
      ECHO For windows 7 home
      ECHO Warning: Can not just be administrator.
      ECHO You need to exit and start this
      ECHO file with owner administrator privileges.
      ecHO The one you unhide and secured right?
      ECHO You also need to start the patch file with
      ECHO administrator privilages.
      ECHO If you already have just countinue.
      ECHO Thank You
      echo.
      ECHO Press ctrl and c to quit or
      echo Press Anykey to continue
      PAUSE > NUL

      :MENU
      CLS

      ECHO ============= MENU NAME =============
      ECHO -------------------------------------
      ECHO 1.  READ ME FIRST
      ECHO -------------------------------------
      ECHO 2.  Selection 2
      ECHO -------------------------------------
      ECHO 3.  Selection 3
      ECHO -------------------------------------
      ECHO 4.  Selection 4
      ECHO -------------------------------------
      ECHO 5.  Selection 5
      ECHO -------------------------------------
      ECHO 6.  Selection 6
      ECHO -------------------------------------
      ECHO 7.  Selection 7
      ECHO -------------------------------------
      ECHO 8.  Selection 8
      ECHO -------------------------------------
      ECHO 9.  Selection 9
      ECHO -------------------------------------
      ECHO ==========PRESS 'Q' TO QUIT==========
      ECHO.

      SET INPUT=
      SET /P INPUT=Please select a number:

      IF /I '%INPUT%'=='1' GOTO Selection1
      IF /I '%INPUT%'=='2' GOTO Selection2
      IF /I '%INPUT%'=='3' GOTO Selection3
      IF /I '%INPUT%'=='4' GOTO Selection4
      IF /I '%INPUT%'=='5' GOTO Selection5
      IF /I '%INPUT%'=='6' GOTO Selection6
      IF /I '%INPUT%'=='7' GOTO Selection7
      IF /I '%INPUT%'=='8' GOTO Selection8
      IF /I '%INPUT%'=='9' GOTO Selection9
      IF /I '%INPUT%'=='0' GOTO Selection9

      IF /I '%INPUT%'=='q' GOTO Quit

      CLS

      ECHO ============INVALID INPUT============
      ECHO -------------------------------------
      ECHO Please select a number from the Main
      echo Menu [1-9] or select 'q' to quit.
      ECHO -------------------------------------
      ECHO ======PRESS ANY KEY TO CONTINUE======

      PAUSE > NUL
      GOTO MENU

      :Selection1

      cls
      echo Ok this is to change your wallpaper on your login screen as if you were to do it manually.
      echo Even though we are doing it in a patch file.
      echo I am in the beginning stages of making this work. The reason I made the script the way I
      echo did is to see and know what I am doing with it. I need to see the errors and know if there needs to be a change.
      echo.
      echo the script is full of pauses and you need to tap on the enter key once or twice to see the script move on
      echo.
      echo if you see a drive letter the just type "exit" and the script will continue.
      echo.
      echo it may ask if you are making a folder or a file i choose "file"
      echo.
      echo it needs some touch up so don't nock it for what it is. think if you had
      echo to do it mannually in a batch file how would you do it.
      echo.
      echo also if you make any changes to these files please zip the folder back up and send it my way. thank you
      echo [email protected]
      echo.
      echo thank you.
      echo Press Any Key when done Reading!
      echo.
      PAUSE > NUL
      Goto Menu

      :Selection2

      echo processing

      C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

      ok at some point i want to reverse what i just done.

      echo 2
      echo press anykey
      PAUSE > NUL
      GOTO MENU

      :Selection3

      cls
      echo 3
      echo press anykey
      PAUSE > NUL
      GOTO MENU

      :Selection4

      cls
      echo 4
      echo press anykey
      PAUSE > NUL
      GOTO MENU

      :Selection5

      cls
      echo 5
      echo press anykey
      PAUSE > NUL
      GOTO MENU

      :Selection6

      cls
      echo 6
      echo press anykey
      PAUSE > NUL
      GOTO MENU

      :Selection7

      cls
      echo 7
      echo press anykey
      PAUSE > NUL
      GOTO MENU

      :Selection8

      cls
      echo 8
      echo press anykey
      PAUSE > NUL
      GOTO MENU

      :Selection9

      cls
      echo 9
      echo press anykey
      PAUSE > NUL
      GOTO MENU

      :Quit
      CLS

      ECHO ==============THANKYOU===============
      ECHO -------------------------------------
      ECHO ======PRESS ANY KEY TO CONTINUE======

      PAUSE>NUL
      EXIT

      ==============================================================

      once i see i have my thoughts about me i was going to make a cleaned up version of the batch. but i see that i am just learning and doing it over again better. i hope. thank  you.
      « Last Edit: March 08, 2014, 04:32:21 PM by snowcatman »

      Salmon Trout

      • Guest
      Re: batch file logging windows 7 home how to question
      « Reply #2 on: March 08, 2014, 05:40:03 PM »
      patch NEQ batch.

      Salmon Trout

      • Guest
      Re: batch file logging windows 7 home how to question
      « Reply #3 on: March 08, 2014, 05:43:30 PM »
      defualt batch script.bat>>log.log

      What is that line supposed to do?

      snowcatman

        Topic Starter


        Beginner

        • Experience: Beginner
        • OS: Windows 8
        Re: batch file logging windows 7 home how to question
        « Reply #4 on: March 08, 2014, 07:49:27 PM »
        logonwallpaper.bat 1> output.txt 2> error.txt
        or
        defualt batch script.bat>>log.log
        is me flirting with the commands to log to file of the batch files
        like in this link
        http://www.msfn.org/board/topic/22253-how-to-log-the-results-of-a-dos-batch-file/
        i am learning here and if i get this right  ">"  clears and logs to a file and  ">>"  appends to a file.

        but my first post is not doing anything and i was wondering what i was doing wrong.
        and my second post is not leaving anything to my log files. so i am in hopes that someone can tell me what simple step i am missing.
        thank you

        defualt.batch.script.bat>>log.log
        i did do this to see if the spaces were the problem but no changes happened. still no info in the log

        foxidrive



          Specialist
        • Thanked: 268
        • Experience: Experienced
        • OS: Windows 8
        Re: batch file logging windows 7 home how to question
        « Reply #5 on: March 09, 2014, 12:21:39 AM »
        Code: [Select]
        @ECHO OFF
        logonwallpaper.bat 1> output.txt 2> error.txt

        Is this batch file above called logonwallpaper.bat

        If so then the 2nd line in the code will launch the same batch file again and again, and never stop.  Nothing will happen.

        If logonwallpaper.bat is a different batch file, then it will launch and none of the code below that line will run, because CALL is needed to launch
        a batch file, so it then returns control to the original code.


        snowcatman

          Topic Starter


          Beginner

          • Experience: Beginner
          • OS: Windows 8
          Re: batch file logging windows 7 home how to question
          « Reply #6 on: March 09, 2014, 07:20:30 AM »
          Thank you fox drive.

          so if i dont want to use another file to log this one what do i do?
          1> output.txt 2> error.txt
          do i just forget the name of the file and run this?
          How do i log the file i am using i wonder? without creating another...

          foxidrive



            Specialist
          • Thanked: 268
          • Experience: Experienced
          • OS: Windows 8
          Re: batch file logging windows 7 home how to question
          « Reply #7 on: March 09, 2014, 08:34:50 AM »
          To log an entire batch file you use this at the command line or in a separate batch file:

          Code: [Select]
          logonwallpaper.bat 1>output.txt 2> error.txt
          The 1 is optional.

          But this will also remove any text that you want to see, and if you have an input command in the batch file then it is not the right way to log it.
          You use the technique above when the batch file is not interactive.

          To get around that you can use a tee filter
          Here is one in a separate batch file and you can use it like this: 
          Code: [Select]
          logonwallpaper.bat | batchtee logfile.txt

          Read the limitations in the batch code below, and there are other tee filters for modern Windows like Swiss File Knife on Sourceforge.


          Code: [Select]
          ::batchTee.bat  OutputFile  [+]
          ::
          ::  Write each line of stdin to both stdout and outputFile.
          ::  The default behavior is to overwrite any existing outputFile.
          ::  If the 2nd argument is + then the content is appended to any existing
          ::  outputFile.
          ::
          ::  Limitations:
          ::
          ::  1) Lines are limited to ~1000 bytes. The exact maximum line length varies
          ::     depending on the line number. The SET /P command is limited to reading
          ::     1021 bytes per line, and each line is prefixed with the line number when
          ::     it is read.
          ::
          ::  2) Trailing control characters are stripped from each line.
          ::
          ::  3) Lines will not appear on the console until a newline is issued, or
          ::     when the input is exhaused. This can be a problem if the left side of
          ::     the pipe issues a prompt and then waits for user input on the same line.
          ::     The prompt will not appear until after the input is provided.
          ::

          @echo off
          setlocal enableDelayedExpansion
          if "%~1" equ ":tee" goto :tee

          :lock
          set "teeTemp=%temp%\tee%time::=_%"
          2>nul (
            9>"%teeTemp%.lock" (
              for %%F in ("%teeTemp%.test") do (
                set "yes="
                pushd "%temp%"
                copy /y nul "%%~nxF" >nul
                for /f "tokens=2 delims=(/" %%A in (
                  '^<nul copy /-y nul "%%~nxF"'
                ) do if not defined yes set "yes=%%A"
                popd
              )
              for /f %%A in ("!yes!") do (
                  find /n /v ""
                   echo :END
                   echo %%A
                ) >"%teeTemp%.tmp" | <"%teeTemp%.tmp" "%~f0" :tee %* 7>&1 >nul
              (call )
            ) || goto :lock
          )
          del "%teeTemp%.lock" "%teeTemp%.tmp" "%teeTemp%.test"
          exit /b

          :tee
          set "redirect=>"
          if "%~3" equ "+" set "redirect=>>"
          8%redirect% %2 (call :tee2)
          set "redirect="
          (echo ERROR: %~nx0 unable to open %2)>&7

          :tee2
          for /l %%. in () do (
            set "ln="
            set /p "ln="
            if defined ln (
              if "!ln:~0,4!" equ ":END" exit
              set "ln=!ln:*]=!"
              (echo(!ln!)>&7
              if defined redirect (echo(!ln!)>&8
            )
          )


          snowcatman

            Topic Starter


            Beginner

            • Experience: Beginner
            • OS: Windows 8
            Re: batch file logging windows 7 home how to question
            « Reply #8 on: March 09, 2014, 09:26:47 AM »
            ok i uncled a little and made a test.batch with: defualt.batch.script.bat 1> output.txt 2> error.txt

            but it did not bring up the second cmd window. and the log file did show my echo's so now i must have a cmd window in the background just sitting waiting for input or not.

            As you can tell this is an interactive script. so i was hoping that i could just log it. but so far it seems i have yet to learn what i need at this time, logging. i have pieced this together this. test.bat
                   cmd /k %~dp0\defualt.batch.script.bat 1>> output.txt 2>> error.txt   ~~~ just sat there too. did append to log files first echos in my script.

            so do i append  of a command every time? do i have to do this with multiple files or is there a way to do it from the first batch file i am using interactively?

            log after command
            echo test>>log.log 2>&1
            mycmd 2>&1 | othercmd
            or
            log one batch with another batch file "a" runs batch file "b"
            cmd /k %~dp0\defualt.batch.script.bat 1>> output.txt 2>> error.txt
            or
            is there a way to do it from batch file "a" altogether interactively?
            ???

            ==================================================
            thank you "foxidrive" i think you set me in the right direction if not answered my question.
            i ran a test of what you posted and just to see what i could see.
            the error log seem to put what was echoed, but very little on the errors. again my learning curve gets in the way. i have been piecing this together. not going to claim it as my own put will say i was learning and this is what i came up with along the way. i guess i want to understand what i am seeing. is there a way to see the errors to. i understand you mentioned there are limitations..
            looking and reading what you posted still. forgive my rudeness please.

            foxidrive



              Specialist
            • Thanked: 268
            • Experience: Experienced
            • OS: Windows 8
            Re: batch file logging windows 7 home how to question
            « Reply #9 on: March 09, 2014, 09:55:25 AM »
            One of the most useful things you can learn is that long filenames with spaces etc can be wrapped in double quotes, and that is how they are used.

            As an example in your code you use this, and your batch file will fail if you launch in in a folder with spaces, or where there are any folders below it with spaces.  Or & characters.

            Code: [Select]
            %~dp0\reshacker
            but if you use double quotes around the path\filenames then it will always work correctly.

            Code: [Select]
            "%~dp0\ResHacker.exe"
            As for logging individual lines, you can use this, assuming your commands are correct: note all the double quotes.

            Code: [Select]
            2>>"error.log" "%~dp0\ResHacker.exe" -addoverwrite "%~dp0\temp\imageres.dll", "%~dp0\temp\imageres1.dll", "%~dp0\cat.jpg", image, 5031,
            2>>"error.log' xcopy "%~dp0\temp\imageres1.dll" "%~dp0\temp\imageres.dll" /c /y /h

            In that way you allow regular text to appear on the console and error messages will appear in the error.log file. 
            Note that double quotes can be used on short filenames as well, so you never have to think about where they should be used, you can always use them.

            Another thing that Salmon Trout brought up - these are not called a patch file, they are called a Batch file.  It is essentially a batch of commands.

            snowcatman

              Topic Starter


              Beginner

              • Experience: Beginner
              • OS: Windows 8
              Re: batch file logging windows 7 home how to question
              « Reply #10 on: March 09, 2014, 10:11:56 AM »
              your one step ahead of me. thank you. "foxidrive"
              ok you posted before me. np. i will make those changes will take some time. I catch myself in a lot of spelling mistakes. yes i use patch and batch wrong. thank you for pointing that out. "Salmon Trout"
              i will repost this when i am done and after a test drive thank you.

              Think if i talk about the rest of my code i might need to start another post.
              I have been cleaning it up.
              but just for the record. i get to a certain point all seems to stop no error code just what was last echoed. the log shows no error.

              :: THIS IS RATHER LONG...
              :: In a external usb hard drive I have a folder
              :: I have windows 7 home. As owner admin I did a ver. in the cmd.exe, results were "Microsoft Windows [version 6.1.7601]"
              ::A picture that meets windows requirements in said folder
              :: I am using "resource hacker [version 3.6.0.92] by angus johnson" in said folder
              :: using the script provided "batchTee.bat" in said folder.  thank you "foxidrive" i omitted reposting that file for you already posted it. there were no changes to name or content. a shorter post this way. feel like i am righting a book. smiles
              ================================================================
              :: start me first.bat
              logonwallpaper.bat | batchtee logfile.txt
              ================================================================
              :: this worked well in my book like a breath of fresh air
              :: just dont see the errors yet
              ================================================================
              :: logonwallpaper.bat
              @ECHO OFF

              CLS
              ECHO For windows 7 home
              ECHO Warning: Can not just be administrator.
              ECHO You need to exit and start this
              ECHO file with owner administrator privileges.
              ecHO The one you unhide and secured right?
              ECHO You also need to start the patch file with
              ECHO administrator privilages.
              ECHO If you already have just countinue.
              ECHO Thank You
              echo.
              ECHO Press ctrl and c to quit or
              echo Press Anykey to continue
              PAUSE > NUL

              :MENU
              CLS

              ECHO ============= MENU NAME =============
              ECHO -------------------------------------
              ECHO 1.  READ ME FIRST
              ECHO -------------------------------------
              ECHO 2.  Set Logon Wallpaper
              ECHO -------------------------------------
              ECHO 3.  test
              ECHO -------------------------------------
              ECHO 4.  Selection 4
              ECHO -------------------------------------
              ECHO 5.  Selection 5
              ECHO -------------------------------------
              ECHO 6.  Selection 6
              ECHO -------------------------------------
              ECHO 7.  Selection 7
              ECHO -------------------------------------
              ECHO 8.  Selection 8
              ECHO -------------------------------------
              ECHO 9.  Selection 9
              ECHO -------------------------------------
              ECHO ==========PRESS 'Q' TO QUIT==========
              ECHO.

              SET INPUT=
              SET /P INPUT=Please select a number:

              IF /I '%INPUT%'=='1' GOTO Selection1
              IF /I '%INPUT%'=='2' GOTO Selection2
              IF /I '%INPUT%'=='3' GOTO Selection3
              IF /I '%INPUT%'=='4' GOTO Selection4
              IF /I '%INPUT%'=='5' GOTO Selection5
              IF /I '%INPUT%'=='6' GOTO Selection6
              IF /I '%INPUT%'=='7' GOTO Selection7
              IF /I '%INPUT%'=='8' GOTO Selection8
              IF /I '%INPUT%'=='9' GOTO Selection9
              IF /I '%INPUT%'=='0' GOTO Selection9

              IF /I '%INPUT%'=='q' GOTO Quit

              CLS

              ECHO ============INVALID INPUT============
              ECHO -------------------------------------
              ECHO Please select a number from the Main
              echo Menu [1-9] or select 'q' to quit.
              ECHO -------------------------------------
              ECHO ======PRESS ANY KEY TO CONTINUE======

              PAUSE > NUL
              GOTO MENU

              :Selection1

              cls
              echo Ok this is to change your wallpaper on your login screen as if you were to do it manually.
              echo Even though we are doing it in a patch file.
              echo I am in the beginning stages of making this work. The reason I made the script the way I
              echo did is to see and know what I am doing with it. I need to see the errors and know if there needs to be a change.
              echo.
              echo the script is full of pauses and you need to tap on the enter key once or twice to see the script move on
              echo.
              echo if you see a drive letter the just type "exit" and the script will continue.
              echo.
              echo it may ask if you are making a folder or a file i choose "file"
              echo.
              echo it needs some touch up so don't nock it for what it is. think if you had
              echo to do it mannually in a batch file how would you do it.
              echo.
              echo also if you make any changes to these files please zip the folder back up and send it my way. thank you
              echo [email protected]
              echo.
              echo thank you.
              echo Press Any Key when done Reading!
              echo.
              PAUSE > NUL
              Goto Menu

              :Selection2

              cls
              echo processing
              echo.
              echo set UAC to disable
              %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
              ECHO.
              echo press anykey
              PAUSE > NUL

              cls
              ECHO KILLING PROCESSES NEEDED FOR Modifying imageres.dll
              @REM need to make this an if statement if process is running kill it other wise next
              taskkill /f /IM explorer.exe
              taskkill /f /IM rundll32.exe
              taskkill /f /IM procexp64.exe
              ECHO.
              echo press anykey
              PAUSE > NUL

              cls
              echo Take Ownership of imageres.dll
              TAKEOWN /F %windir%\system32\imageres.dll
              ICACLS %windir%\system32\imageres.dll /GRANT Administrator:F
              SET __COMPAT_LAYER=WINXPSP3
              ECHO.
              echo press anykey
              PAUSE > NUL

              cls
              echo Make back up of imageres.dll
              xcopy %windir%\system32\imageres.dll "%windir%\system32\imageres.dll.old" /c /y /h | echo make backup copy attempted
              ECHO.
              echo press anykey
              PAUSE > NUL

              cls
              echo Copy imagerers file to folder
              copy %windir%\system32\imageres.dll %~dp0\ | echo attempted copy imageres file to this folder
              ECHO.
              echo press anykey
              PAUSE > NUL

              cls
              Echo Delete imagers file in system folder
              attrib -r -s -h "%windir%\system32\imageres.dll" | echo attrib changed attempted
              del /q /f "%windir%\system32\imageres.dll" | echo imageres.ddl delete attempted in the system folder
              ECHO.
              echo press anykey
              PAUSE > NUL

              cls
              echo step 6 overwrite image to file
              echo [[[ this may take some time pending on you computor processing power]]]
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5031,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo .
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5032,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ..
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5033,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ...
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5034,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ....
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5035,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo .....
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5036,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ......
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5037,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo .......
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5038,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ........
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5039,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ........."25%"
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5040,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ..........
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5041,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ...........
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5042,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ............
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5043,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo .............
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5044,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ..............
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5045,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ..............."50%"
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5046,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ................
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5047,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo .................
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5048,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ..................
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5049,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ...................
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5050,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ...................."75%"
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5051,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo .....................
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5052,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ......................
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5053,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo .......................
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5054,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ........................
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5055,
              xcopy %~dp0\imageres1.dll %~dp0\imageres.dll /c /y /h
              echo ........................
              %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5056,
              echo ........................."100%"
              ECHO.
              echo press anykey
              PAUSE > NUL

              cls
              echo Copy modified imageres file back to systems folder
              xcopy %~dp0\imageres.dll %windir%\system32\imageres.dll /c /y | echo copy attempt of imageres file back to system folder
              ECHO.
              echo press anykey
              PAUSE > NUL

              cls
              echo Set Back Ownership of imageres.dll
              @rem got to learn some day soon.
              ECHO.
              echo press anykey
              PAUSE > NUL

              cls
              ECHO STARTING PROCESSES NEEDED FOR Modifying imageres.dll
              @REM need to make this an if statement if process is not running start it other wise next. note it shouls start if was stopped really.
              start /b explorer.exe
              start /b rundll32.exe
              start /b procexp64.exe
              ECHO.
              echo press anykey
              PAUSE > NUL

              cls
              echo.
              echo set UAC to enable
              %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /f

              cls
              ECHO.
              echo Processing Ended
              ECHO.
              echo press anykey
              PAUSE > NUL
              GOTO MENU

              :Selection3

              cls

              echo test 2>&1 | echo tested
              xcopy  %~dp0\no.jpg %~dp0\ non.jpg 2<&1 test.log | echo tested

              echo 3
              echo press anykey
              PAUSE > NUL
              GOTO MENU

              :Selection4

              cls
              echo 4
              echo press anykey
              PAUSE > NUL
              GOTO MENU

              :Selection5

              cls
              echo 5
              echo press anykey
              PAUSE > NUL
              GOTO MENU

              :Selection6

              cls
              echo 6
              echo press anykey
              PAUSE > NUL
              GOTO MENU

              :Selection7

              cls
              echo 7
              echo press anykey
              PAUSE > NUL
              GOTO MENU

              :Selection8

              cls
              echo 8
              echo press anykey
              PAUSE > NUL
              GOTO MENU

              :Selection9

              cls
              echo 9
              echo press anykey
              PAUSE > NUL
              GOTO MENU

              :Quit
              CLS

              ECHO ==============THANKYOU===============
              ECHO -------------------------------------
              ECHO ======PRESS ANY KEY TO CONTINUE======

              PAUSE>NUL
              EXIT
              ===========================================================
              :: logfile.txt
              ===========================================================
              For windows 7 home
              Warning: Can not just be administrator.
              You need to exit and start this
              file with owner administrator privileges.
              The one you unhide and secured right?
              You also need to start the patch file with
              administrator privilages.
              If you already have just countinue.
              Thank You

              Press ctrl and c to quit or
              Press Anykey to continue
              ============= MENU NAME =============
              -------------------------------------
              1.  READ ME FIRST
              -------------------------------------
              2.  Set Logon Wallpaper
              -------------------------------------
              3.  test
              -------------------------------------
              4.  Selection 4
              -------------------------------------
              5.  Selection 5
              -------------------------------------
              6.  Selection 6
              -------------------------------------
              7.  Selection 7
              -------------------------------------
              8.  Selection 8
              -------------------------------------
              9.  Selection 9
              -------------------------------------
              ==========PRESS 'Q' TO QUIT==========

              Please select a number: processing

              set UAC to disable
              The operation completed successfully.

              press anykey
              KILLING PROCESSES NEEDED FOR Modifying imageres.dll
              SUCCESS: The process "explorer.exe" with PID 1584 has been terminated.

              press anykey
              Take Ownership of imageres.dll

              SUCCESS: The file (or folder): "C:\Windows\system32\imageres.dll" now owned by user "snowballs01\a".
              processed file: C:\Windows\system32\imageres.dll
              Successfully processed 1 files; Failed processing 0 files

              press anykey
              Make back up of imageres.dll
              make backup copy attempted

              ===========================================================
              so far that what i got
              in folder listed
              folder --> imageres contants
              folder --> old files
              batchTea.bat
              cat.jpg
              logfile.txt
              logonwallpaper.bat
              ResHacker.exe
              ResHacker.ini
              ResHacker.log
              start me first.bat
              ----------------------------------------------
              hope i provided enough information. again thank you.

              Salmon Trout

              • Guest
              Re: batch file logging windows 7 home how to question
              « Reply #11 on: March 09, 2014, 10:34:21 AM »
              IF /I '%INPUT%'=='1'

              How many cases can a number have?

              snowcatman

                Topic Starter


                Beginner

                • Experience: Beginner
                • OS: Windows 8
                Re: batch file logging windows 7 home how to question
                « Reply #12 on: March 09, 2014, 11:50:31 AM »
                i expect or assume that if a file already exist's it get's overwritten imageres.dll.old

                cls
                echo Make back up of imageres.dll
                2>>"error.log" "xcopy" "%windir%\system32\imageres.dll" "%windir%\system32\imageres.dll.old" /c /y /h | echo make backup copy attempted
                ECHO.
                echo press anykey
                PAUSE > NUL

                when in xcopy it freezes and in copy it closes the cmd window.
                when look at the log i get this:
                nothing for xcopy, but the with copy i get this---
                ['"copy"' is not recognized as an internal or external command,
                operable program or batch file.]
                my fault i should have know better.
                thank you i see the error batch logging starting to work.

                snowcatman

                  Topic Starter


                  Beginner

                  • Experience: Beginner
                  • OS: Windows 8
                  Re: batch file logging windows 7 home how to question
                  « Reply #13 on: March 09, 2014, 12:56:08 PM »
                  ok fixed my own stuff  :)

                  cls
                  echo Make back up of imageres.dll
                  2>>"error.log" copy "%windir%\system32\imageres.dll" "%windir%\system32\imageres.dll.old" /c /y /h | echo make backup copy attempted
                  ECHO.
                  echo press anykey
                  PAUSE > NUL

                  do you see what i did. xcopy will ask if it is a file or folder. copy already thinks it a file

                  foxidrive



                    Specialist
                  • Thanked: 268
                  • Experience: Experienced
                  • OS: Windows 8
                  Re: batch file logging windows 7 home how to question
                  « Reply #14 on: March 09, 2014, 06:44:28 PM »
                  Salmon Trout pointed this style of line out:

                  Code: [Select]
                  IF /I '%INPUT%'=='1'
                  and it is wiser to use double quotes as below so that a blank enter, or a space, will not break the input checking.  The /I is not needed for numerals, but it won't hurt either.

                  Code: [Select]
                  IF /I "%INPUT%"=="1"
                  You have many instances of %~dp0\filename  which also need double quotes to make the batch file robust.  Even the lone %~dp0\ needs double quotes, see examples below:

                  Code: [Select]
                  "%~dp0\filename"
                  "%~dp0\"

                  In a number of places you are piping through an echo command, and that isn't usual practice.

                  copy %windir%\system32\imageres.dll %~dp0\ | echo attempted copy imageres file to this folder

                  The line above is usually written in this style: where the >nul eliminates the normal text to the screen and you can add
                  the 2>>"error.log" if you want to log any error messages.  Note the double quotes.

                  Code: [Select]
                  copy "%windir%\system32\imageres.dll" "%~dp0\" >nul
                  echo attempted copy imageres file to this folder


                  snowcatman

                    Topic Starter


                    Beginner

                    • Experience: Beginner
                    • OS: Windows 8
                    Re: batch file logging windows 7 home how to question
                    « Reply #15 on: March 09, 2014, 08:00:46 PM »
                    I have changed a view things.

                    still i am thinking, can i join or have  1>>  2>>  together to log some lines?

                    this is what i have so far. i am still fine tuning. your still ahead of me.
                    got to think about were to put the ">nul" now will keep reading over what you post.

                    Thank You both, foxidrive and Salmon Trout

                    this is where i am at so far...
                    error.log file
                    =============================================================================
                    started personal branding script year2014,day09,month03,time18,33.
                    -----------------------------------------------------------------
                    started selection 2 change logon wallpaper 2014,09,03,18 : 33.
                    uac disable
                    KILLING PROCESSES NEEDED FOR Modifying imageres.dll
                    ERROR: The process "taskmgr.exe" not found.
                    ERROR: The process "rundll32.exe" not found.
                    ERROR: The process "procexp64.exe" not found.
                    taking ownership of imagers file
                    'TAKEOWN' is not recognized as an internal or external command,
                    operable program or batch file.
                    'ICACLS' is not recognized as an internal or external command,
                    operable program or batch file.
                    make a backup of imageres file
                    copy imagers to local folder
                    delete system imageres.dll file
                    convert imageres dll file
                    copy back modified emageres.dll file
                    set back ownership of file
                    starting processes killed
                    The system cannot find the file procexp64.exe.
                    enable UAC
                    cleanup time
                    The system cannot find the file specified.
                    The system cannot find the file specified.
                    selection 2 change logon wallpaper ended year2014,day09,month03,time18,35.
                    ------------------------------------------------------------------

                    ==================================================================
                    @rem logonwallpaper.bat
                    @ECHO OFF
                    if not exist "%~dp0\temp" mkdir "%~dp0\temp"
                    @rem i will, or may move this to reflect on the choices of the users. may raneme this file
                    1>>"%~dp0\temp\error.log" echo =============================================================================
                    1>>"%~dp0\temp\error.log" echo started personal branding script year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.

                    CLS
                    ECHO For windows 7 home
                    ECHO Warning: Can not just be administrator.
                    ECHO You need to exit and start this
                    ECHO file with owner administrator privileges.
                    ecHO The one you unhide and secured right?
                    ECHO You also need to start the patch file with
                    ECHO administrator privilages.
                    ECHO If you already have just countinue.
                    ECHO Thank You
                    echo.
                    ECHO Press ctrl and c to quit
                    ECHO AND THEN "Y" or
                    echo Press Anykey to continue
                    ECHO if you did. thank you.
                    PAUSE > NUL

                    :MENU
                    CLS

                    ECHO ============= MENU NAME =============
                    ECHO -------------------------------------
                    ECHO 1.  READ ME FIRST
                    ECHO -------------------------------------
                    ECHO 2.  Set Logon Wallpaper
                    ECHO -------------------------------------
                    ECHO 3.  Selection 3
                    ECHO -------------------------------------
                    ECHO 4.  Selection 4
                    ECHO -------------------------------------
                    ECHO 5.  Selection 5
                    ECHO -------------------------------------
                    ECHO 6.  Selection 6
                    ECHO -------------------------------------
                    ECHO 7.  Selection 7
                    ECHO -------------------------------------
                    ECHO 8.  Selection 8
                    ECHO -------------------------------------
                    ECHO 9.  Selection 9
                    ECHO -------------------------------------
                    ECHO ==========PRESS 'Q' TO QUIT==========
                    ECHO.

                    SET INPUT=
                    SET /P INPUT=Please select a number:

                    IF /I "%INPUT%"=="1" GOTO Selection1
                    IF /I "%INPUT%"=="2" GOTO Selection2
                    IF /I "%INPUT%"=="3" GOTO Selection3
                    IF /I "%INPUT%"=="4" GOTO Selection4
                    IF /I "%INPUT%"=="5" GOTO Selection5
                    IF /I "%INPUT%"=="6" GOTO Selection6
                    IF /I "%INPUT%"=="7" GOTO Selection7
                    IF /I "%INPUT%"=="8" GOTO Selection8
                    IF /I "%INPUT%"=="9" GOTO Selection9
                    IF /I "%INPUT%"=="0" GOTO Selection9

                    IF /I "%INPUT%"=="q" GOTO Quit

                    CLS

                    ECHO ============INVALID INPUT============
                    ECHO -------------------------------------
                    ECHO Please select a number from the Main
                    echo Menu [1-9] or select 'q' to quit.
                    ECHO -------------------------------------
                    ECHO ======PRESS ANY KEY TO CONTINUE======

                    PAUSE > NUL
                    GOTO MENU

                    :Selection1
                    1>>"%~dp0\temp\error.log" echo---------------------------------------------------------------
                    1>>"%~dp0\temp\error.log" echo started selection 1 reading the read me year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.

                    cls
                    echo Ok this is to change your wallpaper on your login screen as if you were to do it manually.
                    echo Even though we are doing it in a patch file.
                    echo I am in the beginning stages of making this work. The reason I made the script the way I
                    echo did is to see and know what I am doing with it. I need to see the errors and know if there needs to be a change.
                    echo.
                    echo the script is full of pauses and you need to tap on the enter key once or twice to see the script move on
                    echo.
                    echo if you see a drive letter the just type "exit" and the script will continue.
                    echo.
                    echo it may ask if you are making a folder or a file i choose "file"
                    echo.
                    echo it needs some touch up so don't nock it for what it is. think if you had
                    echo to do it mannually in a batch file how would you do it.
                    echo.
                    echo also if you make any changes to these files please zip the folder back up and send it my way. thank you
                    echo [email protected]
                    echo.
                    echo thank you.
                    echo Press Any Key when done Reading!
                    echo.
                    PAUSE > NUL
                    Goto Menu

                    :Selection2

                    cls
                    1>>"%~dp0\temp\error.log" echo -----------------------------------------------------------------
                    1>>"%~dp0\temp\error.log" echo started selection 2 change logon wallpaper %date:~-4,4%,%date:~-7,2%,%date:~-10,2%,%time:~-11,2% : %time:~-8,2%.
                    echo processing
                    echo.
                    echo set UAC to disable
                    1>>"%~dp0\temp\error.log" echo uac disable
                    2>>"%~dp0\temp\error.log" "%windir%\System32\reg.exe" ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /f
                    ECHO.
                    echo press anykey
                    PAUSE > NUL
                    @rem 2>>"%~dp0\temp\error.log" sleep.exe 9

                    cls
                    ECHO KILLING PROCESSES NEEDED FOR Modifying imageres.dll
                    1>>"%~dp0\temp\error.log" echo KILLING PROCESSES NEEDED FOR Modifying imageres.dll
                    @REM need to make this an if statement if process is running kill it other wise next
                    @rem for everyone else if you know how to kill processes useing a dll file i would like to know how. thank you.
                    2>>"%~dp0\temp\error.log" %windir%\system32\taskkill /f /IM "taskmgr.exe"
                    2>>"%~dp0\temp\error.log" %windir%\system32\taskkill /f /IM "explorer.exe"
                    2>>"%~dp0\temp\error.log" %windir%\system32\taskkill /f /IM "rundll32.exe"
                    2>>"%~dp0\temp\error.log" %windir%\system32\taskkill /f /IM "procexp64.exe"
                    ECHO.
                    echo press anykey
                    PAUSE > NUL

                    cls
                    echo Take Ownership of imageres.dll
                    1>>"%~dp0\temp\error.log" echo taking ownership of imagers file
                    2>>"%~dp0\temp\error.log" TAKEOWN /F "%windir%\system32\imageres.dll"
                    2>>"%~dp0\temp\error.log" ICACLS "%windir%\system32\imageres.dll" /GRANT Administrators:F

                    @rem don't know were i got this or if it is needed but it is here for now.
                    @rem think when cleaning up script i will test its need.
                    2>>"%~dp0\temp\error.log" SET __COMPAT_LAYER=WINXPSP3

                    ECHO.
                    echo press anykey
                    PAUSE > NUL

                    cls
                    echo Make back up of imageres.dll
                    1>>"%~dp0\temp\error.log" echo make a backup of imageres file
                    2>>"%~dp0\temp\error.log" copy "%windir%\system32\imageres.dll" "%windir%\system32\imageres.dll_%date:~-4,4%%date:~-7,2%%date:~-10,2%%time:~-11,2%%time:~-8,2%.old" /f /r /w | echo make backup copy attempted
                    ECHO.
                    echo press anykey
                    PAUSE > NUL

                    cls
                    echo Copy imagerers file to folder
                    1>>"%~dp0\temp\error.log" echo copy imagers to local folder
                    2>>"%~dp0\temp\error.log" copy "%windir%\system32\imageres.dll" "%~dp0\"
                    echo attempted copy imageres file to this folder
                    ECHO.
                    echo press anykey
                    PAUSE > NUL

                    cls
                    Echo Delete imagers file in system folder
                    1>>"%~dp0\temp\error.log" echo delete system imageres.dll file
                    2>>"%~dp0\temp\error.log" %windir%\system32\attrib -r -s -h "%windir%\system32\imageres.dll"
                    echo attrib changed attempted
                    2>>"%~dp0\temp\error.log" del /q /f "%windir%\system32\imageres.dll"
                    echo imageres.ddl delete attempted in the system folder
                    ECHO.
                    echo press anykey
                    PAUSE > NUL

                    cls
                    echo Overwrite image to file
                    echo.
                    echo this may take some time pending on you computor processing power

                    1>>"%~dp0\temp\error.log" echo convert imageres dll file

                    set path=%~dp0\

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5031,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo .

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5032,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ..

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5033,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ...

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5034,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ....

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5035,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo .....

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5036,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ......

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5037,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo .......

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5038,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ........

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5039,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ........."25%"

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5040,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ..........

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5041,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ...........

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5042,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ............

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5043,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo .............

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5044,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ..............

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5045,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ..............."50%"

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5046,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ................

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5047,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo .................

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5048,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ..................

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5049,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ...................

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5050,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ...................."75%"

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5051,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo .....................

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5052,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ......................

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5053,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo .......................

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5054,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo ........................

                    2>>"%~dp0\temp\error.log" ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5055,
                    2>>"%~dp0\temp\error.log" copy "imageres1.dll" "imageres.dll" /y
                    echo........................

                    %~dp0\ResHacker.exe -addoverwrite %~dp0\imageres.dll, %~dp0\imageres1.dll, %~dp0\cat.jpg, image, 5056,
                    echo ........................."100%"

                    ECHO.
                    echo press anykey
                    PAUSE > NUL

                    cls
                    echo Copy modified imageres file back to systems folder
                    1>>"%~dp0\temp\error.log" echo copy back modified emageres.dll file
                    2>>"%~dp0\temp\error.log" copy "imageres.dll" "%windir%\system32\imageres.dll" /y
                    echo copy attempt of imageres file back to system folder
                    ECHO.
                    echo press anykey
                    PAUSE > NUL

                    cls
                    echo Set Back Ownership of imageres.dll
                    1>>"%~dp0\temp\error.log" echo set back ownership of file
                    @rem got to learn some day soon.
                    ECHO.
                    echo press anykey
                    PAUSE > NUL

                    cls
                    ECHO STARTING PROCESSES NEEDED FOR Modifying imageres.dll
                    @REM need to make this an if statement if process is not running start it other wise next. note it shouls start if was stopped really.
                    1>>"%~dp0\temp\error.log" echo starting processes killed
                    2>>"%~dp0\temp\error.log" start /b explorer.exe
                    2>>"%~dp0\temp\error.log" start /b rundll32.exe
                    2>>"%~dp0\temp\error.log" start /b procexp64.exe
                    ECHO.
                    echo press anykey
                    PAUSE > NUL

                    cls
                    echo.
                    echo set UAC to enable
                    1>>"%~dp0\temp\error.log" echo enable UAC
                    2>>"%~dp0\temp\error.log" %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /f

                    cls
                    echo.
                    echo cleanup time
                    1>>"%~dp0\temp\error.log" echo cleanup time
                    2>>"%~dp0\temp\error.log" move "imagers.dll" "%~dp0\temp"
                    2>>"%~dp0\temp\error.log" move "imagers1.dll" "%~dp0\temp"
                    ECHO.
                    echo press anykey
                    PAUSE > NUL

                    cls
                    ECHO.
                    echo Processing Ended
                    1>>"%~dp0\temp\error.log" echo selection 2 change logon wallpaper ended year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.
                    1>>"%~dp0\temp\error.log" echo ------------------------------------------------------------------
                    ECHO.
                    echo press anykey

                    PAUSE > NUL
                    GOTO MENU

                    :Selection3

                    cls
                    @rem idea to go here; is user icon on start menu or login icon setting
                    echo wait test
                    CALL :sleep 1
                    echo 3
                    echo press anykey
                    PAUSE > NUL
                    GOTO MENU

                    :Selection4

                    cls
                    echo 4
                    echo press anykey
                    PAUSE > NUL
                    GOTO MENU

                    :Selection5

                    cls
                    echo 5
                    echo press anykey
                    PAUSE > NUL
                    GOTO MENU

                    :Selection6

                    cls
                    echo 6
                    echo press anykey
                    PAUSE > NUL
                    GOTO MENU

                    :Selection7

                    cls
                    echo 7
                    echo press anykey
                    PAUSE > NUL
                    GOTO MENU

                    :Selection8

                    cls
                    echo 8
                    echo press anykey
                    PAUSE > NUL
                    GOTO MENU

                    :Selection9

                    cls
                    echo 9
                    echo press anykey
                    PAUSE > NUL
                    GOTO MENU

                    :Quit
                    CLS

                    ECHO ==============THANKYOU===============
                    ECHO -------------------------------------
                    ECHO ======PRESS ANY KEY TO CONTINUE======

                    move "%~dp0\temp\error.log" "%~dp0\temp"

                    PAUSE>NUL
                    EXIT

                    foxidrive



                      Specialist
                    • Thanked: 268
                    • Experience: Experienced
                    • OS: Windows 8
                    Re: batch file logging windows 7 home how to question
                    « Reply #16 on: March 09, 2014, 08:08:52 PM »
                    This is causing a lot of your error messages. 

                    Code: [Select]
                    set path=%~dp0\
                    I didn't check why you were using path as a variable name but if you want to add a directory to the path statement then use this:

                    Code: [Select]
                    set path=%path%;%~dp0
                    Otherwise, never use path as a normal variable name.


                    Quote
                    can i join or have  1>>  2>>  together to log some lines?

                    You can add this to redirect all output to a file.  It redirects the STDOUT stream where normal text goes and then redirects the STDERR stream to the same place that STDOUT is going.

                    You can add this to the start or the end of a line.  If placed at the end then ensure a space is before the first >>

                    Code: [Select]
                    >>"%~dp0\temp\error.log" 2>&1


                    1=STDOUT (standard out)
                    2=STDERR (standard error)

                    snowcatman

                      Topic Starter


                      Beginner

                      • Experience: Beginner
                      • OS: Windows 8
                      Re: batch file logging windows 7 home how to question
                      « Reply #17 on: March 09, 2014, 08:58:50 PM »
                      just to be clear this would work?

                      >>"%~dp0\temp\error.log" 2>&1 command "file"
                      2>&1 >>"%~dp0\temp\error.log" command "file"

                      because its opening notepad and showing the previous errors.
                      « Last Edit: March 09, 2014, 09:14:29 PM by snowcatman »

                      foxidrive



                        Specialist
                      • Thanked: 268
                      • Experience: Experienced
                      • OS: Windows 8
                      Re: batch file logging windows 7 home how to question
                      « Reply #18 on: March 09, 2014, 10:04:33 PM »
                      Both these will work - but include a line at the top to delete the log file before it uses it again:  del "%~dp0\temp\error.log" 2>nul

                      Code: [Select]
                      >>"%~dp0\temp\error.log" 2>&1 command "file"

                      command "file" >>"%~dp0\temp\error.log" 2>&1

                      snowcatman

                        Topic Starter


                        Beginner

                        • Experience: Beginner
                        • OS: Windows 8
                        Re: batch file logging windows 7 home how to question
                        « Reply #19 on: March 09, 2014, 10:31:05 PM »
                        um, i found a major mistake of mine i had doubled my effort to have the log path down. it was opening up the notepad and i was ready to say it not working. but now i am dealing with the cmd window opening up briefly. will go at this tomorrow

                        these are the first two log me commands i used this way
                        >>"%~dp0\temp\error.log" 2>&1  if not exist "%~dp0\temp" mkdir "%~dp0\temp" >nul

                        >>"%~dp0\temp\error.log" 2>&1 "%windir%\System32\reg.exe" ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /f >nul






                        foxidrive



                          Specialist
                        • Thanked: 268
                        • Experience: Experienced
                        • OS: Windows 8
                        Re: batch file logging windows 7 home how to question
                        « Reply #20 on: March 10, 2014, 12:07:35 AM »
                        The first one doesn't need logging - try the second one in a command line by itself to see if it works.

                        I did see that you seem to be trying to disable UAC and that hasn't been possible by command line to date. 
                        There is no way to programmatically disable UAC at this point in time.

                        Code: [Select]
                        if not exist "%~dp0\temp" mkdir "%~dp0\temp"

                        >>"%~dp0\temp\error.log" 2>&1 "%windir%\System32\reg.exe" ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /f

                        snowcatman

                          Topic Starter


                          Beginner

                          • Experience: Beginner
                          • OS: Windows 8
                          Re: batch file logging windows 7 home how to question
                          « Reply #21 on: March 10, 2014, 07:49:22 AM »
                          good morning. um, when it comes to the UAC i just want it to stop messing with the imageres.dll file long enough for me to to modify it and replace it. i found it helpful. to simple to change it's registry.
                          if i wanted i could have the user reboot several times to make the change have more of an impact. but did not see a reason way i should.

                          this script is already looking better. thank's to all your help, "foxidrive" and "Salmon Trout"

                          I am still seeing errors in console and not in the errors log. a good example would be the "killing of processes".

                          information you did not have is i am using a virtual box to test this in.


                          -------------------------begining of batch script-------------------------
                          ==========================================================================
                          started personal branding script year2014,day10,month03,time 6,38.
                          -----------------------------------------------------------------
                          started selection 2 change logon wallpaper 2014,10,03, 6 : 38.
                          uac temp disable
                          KILLING PROCESSES NEEDED FOR Modifying imageres.dll
                          taking ownership of imagers file
                          make a backup of imageres file
                          copy imagers to local folder
                          delete system imageres.dll file
                          convert imageres dll file
                          copy back modified emageres.dll file
                          set back ownership of file
                          starting processes killed
                          enable UAC
                          cleanup time
                          selection 2 change logon wallpaper ended year2014,day10,month03,time 6,41.
                          ------------------------------------------------------------------
                          =======================================================================
                          --------------------------end of batch script--------------------------

                          @rem logonwallpaper.bat
                          @ECHO OFF
                          if not exist "%~dp0\temp" mkdir "%~dp0\temp" >nul
                          @rem i will, or may move this to reflect on the choices of the users. may raname this file
                          1>>"%~dp0\temp\error.log" echo -------------------------begining of batch script-------------------------
                          1>>"%~dp0\temp\error.log" echo ==========================================================================
                          1>>"%~dp0\temp\error.log" echo started personal branding script year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.

                          CLS
                          ECHO For windows 7 home
                          ECHO Warning: Can not just be administrator.
                          ECHO You need to exit and start this
                          ECHO file with owner administrator privileges.
                          ecHO The one you unhide and secured right?
                          ECHO You also need to start the patch file with
                          ECHO administrator privilages.
                          ECHO If you already have just countinue.
                          ECHO Thank You
                          echo.
                          ECHO Press ctrl and c to quit
                          ECHO AND THEN "Y" or
                          echo Press Anykey to continue
                          ECHO if you did. thank you.
                          PAUSE > NUL

                          :MENU
                          CLS

                          ECHO ============= MENU NAME =============
                          ECHO -------------------------------------
                          ECHO 1.  READ ME FIRST
                          ECHO -------------------------------------
                          ECHO 2.  Set Logon Wallpaper
                          ECHO -------------------------------------
                          ECHO 3.  Selection 3
                          ECHO -------------------------------------
                          ECHO 4.  Selection 4
                          ECHO -------------------------------------
                          ECHO 5.  Selection 5
                          ECHO -------------------------------------
                          ECHO 6.  Selection 6
                          ECHO -------------------------------------
                          ECHO 7.  Selection 7
                          ECHO -------------------------------------
                          ECHO 8.  Selection 8
                          ECHO -------------------------------------
                          ECHO 9.  Selection 9
                          ECHO -------------------------------------
                          ECHO ==========PRESS 'Q' TO QUIT==========
                          ECHO.

                          SET INPUT=
                          SET /P INPUT=Please select a number:

                          IF /I "%INPUT%"=="1" GOTO Selection1
                          IF /I "%INPUT%"=="2" GOTO Selection2
                          IF /I "%INPUT%"=="3" GOTO Selection3
                          IF /I "%INPUT%"=="4" GOTO Selection4
                          IF /I "%INPUT%"=="5" GOTO Selection5
                          IF /I "%INPUT%"=="6" GOTO Selection6
                          IF /I "%INPUT%"=="7" GOTO Selection7
                          IF /I "%INPUT%"=="8" GOTO Selection8
                          IF /I "%INPUT%"=="9" GOTO Selection9
                          IF /I "%INPUT%"=="0" GOTO Selection9

                          IF /I "%INPUT%"=="q" GOTO Quit

                          CLS

                          ECHO ============INVALID INPUT============
                          ECHO -------------------------------------
                          ECHO Please select a number from the Main
                          echo Menu [1-9] or select 'q' to quit.
                          ECHO -------------------------------------
                          ECHO ======PRESS ANY KEY TO CONTINUE======

                          PAUSE > NUL
                          GOTO MENU

                          :Selection1
                          1>>"%~dp0\temp\error.log" echo---------------------------------------------------------------
                          1>>"%~dp0\temp\error.log" echo started selection 1 reading the read me year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.

                          cls

                          echo -------------reboot your computer in between uses for smoother operation-----------------------
                          echo.
                          echo Ok this is to change your wallpaper on your login screen as if you were to do it manually in dos.
                          echo Even though we are doing it in a patch file.
                          echo I am in the beginning stages of making this work. The reason I made the script the way I
                          echo did is to see and know what I am doing with it. I need to see the errors and know if there needs to be a change.
                          echo.
                          echo the script is full of pauses and you need to tap on the enter key once or twice to see the script move on
                          echo.
                          echo if you see a drive letter then just type "exit" and the script will continue or not. you need to be
                          echo familier with task manager and able to start at least explorer.exe
                          echo.
                          echo it may ask if you are making a folder or a file. I choose "file". we are not making more then a temp folder
                          echo from the begining of this batch file
                          echo.
                          echo it needs some touch up so don't nock it for what it is. think if you had
                          echo to do it mannually in a batch file might make a few mistakes when you do it.
                          echo.
                          echo also if you make any changes to these files please zip the folder back up and send it my way. thank you
                          echo [email protected] i hould be interested in your changes. please leave notes.
                          echo.
                          echo thank you.
                          echo Press Any Key when done Reading!
                          echo.
                          PAUSE > NUL
                          Goto Menu

                          :Selection2

                          cls
                          1>>"%~dp0\temp\error.log" echo -----------------------------------------------------------------
                          1>>"%~dp0\temp\error.log" echo started selection 2 change logon wallpaper %date:~-4,4%,%date:~-7,2%,%date:~-10,2%,%time:~-11,2% : %time:~-8,2%.
                          echo processing
                          echo.
                          echo set UAC to disable
                          @rem note: foxidrive noted; I did see that you seem to be trying to disable UAC and that hasn't been
                          @rem possible by command line to date. There is no way to programmatically disable UAC at this point in time.
                          @rem selfnote. i only want some of the processes to leave imageres.dll alone. not to fully disable UAC
                          @rem future note, may need to fully disable UAC. need to think on how to go about returning to script after reboot for that.

                          1>>"%~dp0\temp\error.log" echo uac temp disable
                          >>"%~dp0\temp\error.log" 2>&1 "%windir%\System32\reg.exe" ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /f >nul
                          ECHO.
                          echo press anykey
                          PAUSE > NUL

                          cls
                          ECHO KILLING PROCESSES NEEDED FOR Modifying imageres.dll
                          1>>"%~dp0\temp\error.log" echo KILLING PROCESSES NEEDED FOR Modifying imageres.dll
                          @REM need to make this an if statement if process is running kill it other wise next
                          @rem for everyone else if you know how to kill processes depening on a curent dll file i would like to know how. thank you.
                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\taskkill /f /IM "taskmgr.exe" >nul
                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\taskkill /f /IM "explorer.exe" >nul
                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\taskkill /f /IM "rundll32.exe" >nul
                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\taskkill /f /IM "procexp64.exe" >nul
                          ECHO.
                          echo press anykey
                          PAUSE > NUL

                          cls
                          echo Take Ownership of imageres.dll
                          1>>"%~dp0\temp\error.log" echo taking ownership of imagers file
                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\TAKEOWN /F "%windir%\system32\imageres.dll" >nul
                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\ICACLS "%windir%\system32\imageres.dll" /GRANT Administrators:F >nul

                          @rem don't know were i got this or if it is needed but it is here for now.
                          @rem think when cleaning up script i will test its need.
                          >>"%~dp0\temp\error.log" 2>&1 SET __COMPAT_LAYER=WINXPSP3 >nul

                          ECHO.
                          echo press anykey
                          PAUSE > NUL

                          cls
                          echo Make back up of imageres.dll
                          1>>"%~dp0\temp\error.log" echo make a backup of imageres file
                          >>"%~dp0\temp\error.log" 2>&1  copy "%windir%\system32\imageres.dll" "%windir%\system32\imageres.dll_%date:~-4,4%%date:~-7,2%%date:~-10,2%%time:~-11,2%%time:~-8,2%.old" /f /r /w >nul
                          echo make backup copy attempted
                          ECHO.
                          echo press anykey
                          PAUSE > NUL

                          cls
                          echo Copy imagerers file to folder
                          1>>"%~dp0\temp\error.log" echo copy imagers to local folder
                          >>"%~dp0\temp\error.log" 2>&1  copy "%windir%\system32\imageres.dll" "%~dp0\" >nul
                          echo attempted copy imageres file to this folder
                          ECHO.
                          echo press anykey
                          PAUSE > NUL

                          cls
                          Echo Delete imagers file in system folder
                          1>>"%~dp0\temp\error.log" echo delete system imageres.dll file
                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\attrib -r -s -h "%windir%\system32\imageres.dll" >nul
                          echo attrib changed attempted
                          >>"%~dp0\temp\error.log" 2>&1  del /q /f "%windir%\system32\imageres.dll" >nul
                          echo imageres.ddl delete attempted in the system folder
                          ECHO.
                          echo press anykey
                          PAUSE > NUL

                          cls
                          echo Overwrite image to file
                          echo.
                          echo this may take some time pending on you computor processing power

                          1>>"%~dp0\temp\error.log" echo convert imageres dll file

                          set path=%path%;%~dp0

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5031,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo .

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5032,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ..

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5033,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ...

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5034,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ....

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5035,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo .....

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5036,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ......

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5037,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo .......

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5038,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ........

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5039,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ........."25%"

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5040,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ..........

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5041,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ...........

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5042,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ............

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5043,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo .............

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5044,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ..............

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5045,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ..............."50%"

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5046,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ................

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5047,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo .................

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5048,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ..................

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5049,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ...................

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5050,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ...................."75%"

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5051,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo .....................

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5052,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ......................

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5053,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo .......................

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5054,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo ........................

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5055,
                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y >nul
                          echo........................

                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "cat.jpg", image, 5056,
                          echo ........................."100%"

                          ECHO.
                          echo press anykey
                          PAUSE > NUL

                          cls
                          echo Copy modified imageres file back to systems folder
                          1>>"%~dp0\temp\error.log" echo copy back modified emageres.dll file
                          >>"%~dp0\temp\error.log" 2>&1" %~dp0\temp\error.log" copy "imageres.dll" "%windir%\system32\imageres.dll" /y >nul
                          echo copy attempt of imageres file back to system folder
                          ECHO.
                          echo press anykey
                          PAUSE > NUL

                          cls
                          echo Set Back Ownership of imageres.dll
                          1>>"%~dp0\temp\error.log" echo set back ownership of file
                          @rem got to learn some day soon.
                          ECHO.
                          echo press anykey
                          PAUSE > NUL

                          cls
                          ECHO STARTING PROCESSES depending on imageres.dll
                          @REM need to make this an if statement if process was killed then restart it.
                          1>>"%~dp0\temp\error.log" echo starting processes killed
                          >>"%~dp0\temp\error.log" 2>&1  start /b explorer.exe >nul
                          >>"%~dp0\temp\error.log" 2>&1  start /b rundll32.exe >nul
                          >>"%~dp0\temp\error.log" 2>&1  start /b procexp64.exe >nul
                          ECHO.
                          echo press anykey
                          PAUSE > NUL

                          cls
                          echo.
                          echo set UAC to enable
                          1>>"%~dp0\temp\error.log" echo enable UAC
                          >>"%~dp0\temp\error.log" 2>&1  %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /f >nul

                          cls
                          echo.
                          echo cleanup time
                          1>>"%~dp0\temp\error.log" echo cleanup time
                          >>"%~dp0\temp\error.log" 2>&1  move "imagers.dll" "%~dp0\temp" >nul
                          >>"%~dp0\temp\error.log" 2>&1  move "imagers1.dll" "%~dp0\temp" >nul
                          ECHO.
                          echo press anykey
                          PAUSE > NUL

                          cls
                          ECHO.
                          echo Processing Ended
                          1>>"%~dp0\temp\error.log" echo selection 2 change logon wallpaper ended year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.
                          1>>"%~dp0\temp\error.log" echo ------------------------------------------------------------------
                          ECHO.
                          echo press anykey

                          PAUSE > NUL
                          GOTO MENU

                          :Selection3

                          cls
                          @rem idea to go here; is user icon on start menu or login icon setting
                          echo wait test
                          CALL :sleep 1
                          echo 3
                          echo press anykey
                          PAUSE > NUL
                          GOTO MENU

                          :Selection4

                          cls
                          echo 4
                          echo press anykey
                          PAUSE > NUL
                          GOTO MENU

                          :Selection5

                          cls
                          echo 5
                          echo press anykey
                          PAUSE > NUL
                          GOTO MENU

                          :Selection6

                          cls
                          echo 6
                          echo press anykey
                          PAUSE > NUL
                          GOTO MENU

                          :Selection7

                          cls
                          echo 7
                          echo press anykey
                          PAUSE > NUL
                          GOTO MENU

                          :Selection8

                          cls
                          echo 8
                          echo press anykey
                          PAUSE > NUL
                          GOTO MENU

                          :Selection9

                          cls
                          echo 9
                          echo press anykey
                          PAUSE > NUL
                          GOTO MENU

                          :Quit
                          CLS

                          ECHO ==============THANKYOU===============
                          ECHO -------------------------------------
                          ECHO ======PRESS ANY KEY TO CONTINUE======

                          1>>"%~dp0\temp\error.log" echo =======================================================================
                          1>>"%~dp0\temp\error.log" echo --------------------------end of batch script--------------------------

                          move "%~dp0\temp\error.log" "%~dp0\temp" >nul

                          PAUSE>NUL
                          EXIT

                          snowcatman

                            Topic Starter


                            Beginner

                            • Experience: Beginner
                            • OS: Windows 8
                            Re: batch file logging windows 7 home how to question
                            « Reply #22 on: March 10, 2014, 01:51:01 PM »
                            dont know if its logging right or if i need to start another thread but here it goes.
                            getting some strange errors too
                            source commands: from logonwallpaper.bat

                            cls
                            Echo Delete imagers file in system folder
                            1>>"%~dp0\temp\error.log" echo delete system imageres.dll file attempted
                            >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\attrib -r -s -h "%windir%\system32\imageres.dll" >nul
                            echo attrib changed attempted
                            >>"%~dp0\temp\error.log" 2>&1  del /f /a h s  "%windir%\system32\imageres.dll"
                            echo imageres.ddl delete attempted in the system folder
                            ECHO.
                            echo press anykey
                            PAUSE > NUL

                            error.log

                            ----------------------------------------------------------------------------------
                              -------------------------begining of batch script-------------------------
                            ==========================================================================
                            started personal branding script year2014,day10,month03,time12,36.
                            -----------------------------------------------------------------
                            started selection 2 change logon wallpaper 2014,10,03,12 : 36.
                            uac temp disable
                            KILLING PROCESSES NEEDED FOR Modifying imageres.dll
                            taking ownership of imagers file
                            make a backup of imageres file
                            copy imagers to local folder
                            delete system imageres.dll file attempted
                            Could Not Find F:\PortableApps\Notepad++Portable\App\Notepad++\h
                            Could Not Find C:\Windows\system32\imageres.dll

                            convert imageres dll file
                            copy back modified emageres.dll file
                            set back ownership of file
                            starting processes killed
                            enable UAC
                            cleanup time
                            selection 2 change logon wallpaper ended year2014,day10,month03,time12,36.
                            ------------------------------------------------------------------
                            =======================================================================
                            --------------------------end of batch script--------------------------


                            i checked and the file imageres.dll was in the %windir%\system32\ so there must be an error?

                            did the batch outside notepad++ and got this...

                            -------------------------begining of batch script-------------------------
                            ==========================================================================
                            started personal branding script year2014,day10,month03,time12,58.
                            -----------------------------------------------------------------
                            started selection 2 change logon wallpaper 2014,10,03,12 : 59.
                            uac temp disable
                            KILLING PROCESSES NEEDED FOR Modifying imageres.dll
                            taking ownership of imagers file
                            make a backup of imageres file
                            copy imagers to local folder
                            delete system imageres.dll file attempted
                            Could Not Find E:\BATCH.START\h
                            convert imageres dll file
                            copy back modified emageres.dll file
                            set back ownership of file
                            starting processes killed
                            enable UAC
                            cleanup time
                            selection 2 change logon wallpaper ended year2014,day10,month03,time13,04.
                            ------------------------------------------------------------------
                            =======================================================================
                            --------------------------end of batch script--------------------------
                            « Last Edit: March 10, 2014, 02:21:04 PM by snowcatman »

                            foxidrive



                              Specialist
                            • Thanked: 268
                            • Experience: Experienced
                            • OS: Windows 8
                            Re: batch file logging windows 7 home how to question
                            « Reply #23 on: March 10, 2014, 05:50:25 PM »
                            I added the two pause commands and when they appear check "%windir%\system32\imageres.dll" to see what attributes it has, and if it is being deleted.


                            Code: [Select]
                            cls
                            Echo Delete imagers file in system folder
                            1>>"%~dp0\temp\error.log" echo delete system imageres.dll file
                            2>>"%~dp0\temp\error.log" %windir%\system32\attrib -r -s -h "%windir%\system32\imageres.dll"
                            pause
                            echo attrib changed attempted
                            2>>"%~dp0\temp\error.log" del /q /f "%windir%\system32\imageres.dll"
                            pause
                            echo imageres.ddl delete attempted in the system folder
                            ECHO.

                            snowcatman

                              Topic Starter


                              Beginner

                              • Experience: Beginner
                              • OS: Windows 8
                              Re: batch file logging windows 7 home how to question
                              « Reply #24 on: March 10, 2014, 09:52:40 PM »
                              ok there were no errors but something is still amiss because i see the rest of the script going really fast. like  its missing the imageres file.
                              plus i see error in the console instead of the error log. i don't mind seeing them in the console but would like to see them in the error log too.

                              -------------------------begining of batch script-------------------------
                              ==========================================================================
                              started personal branding script year2014,day10,month03,time20,37.
                              -----------------------------------------------------------------
                              started selection 2 change logon wallpaper 2014,10,03,20 : 37.
                              uac temp disable
                              KILLING PROCESSES NEEDED FOR Modifying imageres.dll
                              taking ownership of imagers file
                              make a backup of imageres file
                              copy imagers to local folder
                              delete system imageres.dll file
                              convert imageres dll file
                              copy back modified emageres.dll file
                              set back ownership of file
                              starting processes killed
                              enable UAC
                              cleanup time
                              selection 2 change logon wallpaper ended year2014,day10,month03,time20,37.
                              ------------------------------------------------------------------
                              =======================================================================
                              --------------------------end of batch script--------------------------


                              i guess its just looking better. it's getting harder to tell whats going on in there too.

                              i have been wrecking my brain on how to deal with this one file. it plague me. its like windows makes use of this file in a multitude of ways. imageres.dll has icons and a sound file as well as wallpaper it . i seen some programming too. i think what i am going to have to do is start windows in dos mode and run the batch file. maybe it will work then. don't know

                              foxidrive



                                Specialist
                              • Thanked: 268
                              • Experience: Experienced
                              • OS: Windows 8
                              Re: batch file logging windows 7 home how to question
                              « Reply #25 on: March 10, 2014, 10:20:07 PM »
                              There's a command line tool here to change wallpaper.

                              http://sg20.com/techblog/2011/06/23/wallpaper-changer-command-line-utility/

                              snowcatman

                                Topic Starter


                                Beginner

                                • Experience: Beginner
                                • OS: Windows 8
                                Re: batch file logging windows 7 home how to question
                                « Reply #26 on: March 11, 2014, 06:54:59 AM »
                                Good morning.
                                Thank you for that link foxidrive

                                not chewing you out. this just fyi. thank you.
                                din't know if you noticed. but this is not the wallpaper on you work space that i am changing. it's the wallpaper on your "logon screen" that i am changing. windows does not provide a user friendly way to change this. If at all. I know there is programming out there already that does this. I am just am trying to learn how to do it. so to learn and leave steps or notes on how to do it. For the fun of it.

                                for the most part it works. i just keep finding the errors in a batch script and want to clean it up.
                                the problem is a user is going to use this multiple times. and windows seems to use that file "imageres.dll" in multitude of way's.
                                hence my problem. the "imageres.dll" gets locked up easily. from permissions to uac to attributes, file in use, etc

                                keeping on topic.
                                --------------------------------------------------------

                                1>>"%~dp0\temp\error.log" command file >nul  ---> works well
                                2>>"%~dp0\temp\error.log" command file >nul  ---> works well
                                >>"%~dp0\temp\error.log" 2>&1 command file >nul  ---> works well

                                the problem notice here is "cls" gets modified and the screen just allowed to scroll up. nice but not very friendly.
                                To log an entire batch file you use this at the command line or in a separate batch file:


                                Code: [Select]
                                logonwallpaper.bat 1>output.txt 2> error.txt
                                The 1 is optional.

                                But this will also remove any text that you want to see, and if you have an input command in the batch file then it is not the right way to log it.
                                You use the technique above when the batch file is not interactive.

                                To get around that you can use a tee filter
                                Here is one in a separate batch file and you can use it like this: 
                                Code: [Select]
                                logonwallpaper.bat | batchtee logfile.txt

                                Read the limitations in the batch code below, and there are other tee filters for modern Windows like Swiss File Knife on Sourceforge.


                                Code: [Select]
                                ::batchTee.bat  OutputFile  [+]
                                ::
                                ::  Write each line of stdin to both stdout and outputFile.
                                ::  The default behavior is to overwrite any existing outputFile.
                                ::  If the 2nd argument is + then the content is appended to any existing
                                ::  outputFile.
                                ::
                                ::  Limitations:
                                ::
                                ::  1) Lines are limited to ~1000 bytes. The exact maximum line length varies
                                ::     depending on the line number. The SET /P command is limited to reading
                                ::     1021 bytes per line, and each line is prefixed with the line number when
                                ::     it is read.
                                ::
                                ::  2) Trailing control characters are stripped from each line.
                                ::
                                ::  3) Lines will not appear on the console until a newline is issued, or
                                ::     when the input is exhaused. This can be a problem if the left side of
                                ::     the pipe issues a prompt and then waits for user input on the same line.
                                ::     The prompt will not appear until after the input is provided.
                                ::

                                @echo off
                                setlocal enableDelayedExpansion
                                if "%~1" equ ":tee" goto :tee

                                :lock
                                set "teeTemp=%temp%\tee%time::=_%"
                                2>nul (
                                  9>"%teeTemp%.lock" (
                                    for %%F in ("%teeTemp%.test") do (
                                      set "yes="
                                      pushd "%temp%"
                                      copy /y nul "%%~nxF" >nul
                                      for /f "tokens=2 delims=(/" %%A in (
                                        '^<nul copy /-y nul "%%~nxF"'
                                      ) do if not defined yes set "yes=%%A"
                                      popd
                                    )
                                    for /f %%A in ("!yes!") do (
                                        find /n /v ""
                                         echo :END
                                         echo %%A
                                      ) >"%teeTemp%.tmp" | <"%teeTemp%.tmp" "%~f0" :tee %* 7>&1 >nul
                                    (call )
                                  ) || goto :lock
                                )
                                del "%teeTemp%.lock" "%teeTemp%.tmp" "%teeTemp%.test"
                                exit /b

                                :tee
                                set "redirect=>"
                                if "%~3" equ "+" set "redirect=>>"
                                8%redirect% %2 (call :tee2)
                                set "redirect="
                                (echo ERROR: %~nx0 unable to open %2)>&7

                                :tee2
                                for /l %%. in () do (
                                  set "ln="
                                  set /p "ln="
                                  if defined ln (
                                    if "!ln:~0,4!" equ ":END" exit
                                    set "ln=!ln:*]=!"
                                    (echo(!ln!)>&7
                                    if defined redirect (echo(!ln!)>&8
                                  )
                                )



                                logonwallpaper.bat 1>output.txt 2> error.txt

                                i am looking at the different ways to log the errors and want to see how to fix my issues.

                                you have been a asset and thank you for your help. i don't know all there is to know put am putting the effort into learning what i can. thank you for your patience.

                                Hope i put enough info out for review and not to much. again thank you.

                                i think in order to slow down this script i need to switch to if then statements and do something about check the file states. just a thought.
                                « Last Edit: March 11, 2014, 07:49:46 AM by snowcatman »

                                snowcatman

                                  Topic Starter


                                  Beginner

                                  • Experience: Beginner
                                  • OS: Windows 8
                                  Re: batch file logging windows 7 home how to question
                                  « Reply #27 on: March 11, 2014, 09:54:47 AM »
                                  thinking about just not deleting the imageres.dll. causes too may issues. instead i will considerate on replacing it.

                                  snowcatman

                                    Topic Starter


                                    Beginner

                                    • Experience: Beginner
                                    • OS: Windows 8
                                    Re: batch file logging windows 7 home how to question
                                    « Reply #28 on: March 11, 2014, 05:06:19 PM »
                                    ok i seen something that makes cents to me now. kinda went way over my head... ::)

                                    1>>"%~dp0\temp\error.log" command file >nul
                                    Works well, ya it worked but you are not going to get a much of message in your error.log.

                                    1>>"%~dp0\temp\error.log" command file                     <-----note no >null
                                    Ok this works too. but now you will see the STDOUT and STDERR messages in your log file.

                                    1>>"%~dp0\temp\error.log"            notice no comand file or >nul ???
                                    I also noticed if you don't complete you line then you break your cmd the window closes.

                                    Squashman



                                      Specialist
                                    • Thanked: 134
                                    • Experience: Experienced
                                    • OS: Other
                                    Re: batch file logging windows 7 home how to question
                                    « Reply #29 on: March 11, 2014, 05:46:44 PM »
                                    Seems like it would be a lot easier to do this. You could script this as well but  you would still get UAC prompts.
                                    http://www.techrepublic.com/blog/windows-and-office/change-and-customize-windows-7s-logon-screen-wallpaper/

                                    snowcatman

                                      Topic Starter


                                      Beginner

                                      • Experience: Beginner
                                      • OS: Windows 8
                                      Re: batch file logging windows 7 home how to question
                                      « Reply #30 on: March 11, 2014, 07:40:20 PM »
                                      Squashman ;D

                                      Thank you for that link. I see the instructions all over the place. but i found that it does not seem to be that easy. not all windows 7 home threw ultimate are alike. thank the venders( hp, dell, etc ) maybe even windows microsoft. you make these settings and even on a reboot or hard boot nothing happens. not always anyway.
                                      i hear some are successful. not me i am not one of them.

                                      so i did a little more digging and found out were the main files are located and one stuck out like a sore thumb. imageres.dll. also in the imageres.dll file is were you can change the wallpaper, start-up sound that is unavailable, and most if not all the icons windows uses. there is even some programming in there, i have yet to figure out. guess its a matter of time before i figure it out.

                                      i am just learning batch and "logging" while honing in on how to change that wallpaper for the logon.

                                      thank you for your info and time.

                                      foxidrive



                                        Specialist
                                      • Thanked: 268
                                      • Experience: Experienced
                                      • OS: Windows 8
                                      Re: batch file logging windows 7 home how to question
                                      « Reply #31 on: March 11, 2014, 08:23:24 PM »
                                      din't know if you noticed. but this is not the wallpaper on you work space that i am changing. it's the wallpaper on your "logon screen" that i am changing.

                                      Oops. No, I didn't notice at all.  Mea Culpa.




                                      foxidrive



                                        Specialist
                                      • Thanked: 268
                                      • Experience: Experienced
                                      • OS: Windows 8
                                      Re: batch file logging windows 7 home how to question
                                      « Reply #32 on: March 11, 2014, 08:27:13 PM »
                                      Seems like it would be a lot easier to do this. You could script this as well but  you would still get UAC prompts.
                                      http://www.techrepublic.com/blog/windows-and-office/change-and-customize-windows-7s-logon-screen-wallpaper/

                                      From Squashmans's link there is this, which may apply to your case too.

                                      Quote
                                      Two other things to keep in mind: First, the actual file size of backgroundDefault.jpg cannot exceed 256 KB. Second, you'll want to use an image whose dimensions match the screen resolution that you are using. If you use a file whose dimensions are smaller, the image will be stretched and may appear distorted.

                                      snowcatman

                                        Topic Starter


                                        Beginner

                                        • Experience: Beginner
                                        • OS: Windows 8
                                        Re: batch file logging windows 7 home how to question
                                        « Reply #33 on: March 11, 2014, 09:04:10 PM »
                                        foxidrive    ;D

                                        Thank you for pointing that out.

                                        I already knew this information.

                                        Quote from Squashmans's link
                                        Two other things to keep in mind: First, the actual file size of backgroundDefault.jpg cannot exceed 256 KB. Second, you'll want to use an image whose dimensions match the screen resolution that you are using. If you use a file whose dimensions are smaller, the image will be stretched and may appear distorted.

                                        i should have stated it in a clearer way earlier.

                                        again Thank You.

                                        P.S. there are plan's in the iron work down the road that will address and implement all the different screen resolutions. that are in the imageres.dll file. again thank you..

                                        snowcatman

                                          Topic Starter


                                          Beginner

                                          • Experience: Beginner
                                          • OS: Windows 8
                                          Re: batch file logging windows 7 home how to question
                                          « Reply #34 on: March 11, 2014, 10:00:16 PM »
                                          Back to how:    batch file logging windows 7 home how to question
                                          ================================================

                                          all this in owner administrator

                                          i find in my log:
                                          script piece used:
                                           >>"%~dp0\temp\error.log" 2>&1" copy "imageres.dll" "%windir%\system32\imageres.dll" /y
                                          error --> The filename, directory name, or volume label syntax is incorrect.

                                          when i go to a cmd: access using admin rights
                                          copy "imageres.dll" "%windir%\system32\imageres.dll" /y
                                          error --> Access is denied

                                          in the consel: batch ran with admin right
                                          >>"%~dp0\temp\error.log" 2>&1" copy "imageres.dll" "%windir%\system32\imageres.dll" /y
                                          I don't see any error!

                                          anyone have anymore about logging while i look at way i am getting these errors.
                                          thank you for you time and effort in advanced.


                                          here is what i have changed so far. i change a few thing and did a little more orginizing. really not too much of a change
                                          ====================================================================


                                          @rem logonwallpaper.bat
                                          @ECHO OFF
                                          if not exist "%~dp0\temp" mkdir "%~dp0\temp"
                                          @rem i will, or may move this to reflect on the choices of the users. may raname this file
                                          1>>"%~dp0\temp\error.log" echo -------------------------begining of batch script-------------------------
                                          1>>"%~dp0\temp\error.log" echo ==========================================================================
                                          1>>"%~dp0\temp\error.log" echo started personal branding script year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.

                                          CLS
                                          ECHO For windows 7 home threw ultimate
                                          echo.
                                          ECHO WARNING: YOU Can not just be administrator.
                                          ECHO You need to exit and start this
                                          ECHO file with OWNER ADMINISTRATOR privileges.
                                          ecHO The one you unhide and secured right?
                                          ECHO You also need to start the patch file with
                                          ECHO administrator privilages.
                                          ECHO If you already have just countinue.
                                          ECHO Thank You
                                          echo.
                                          ECHO Press ctrl and c to quit
                                          ECHO AND THEN "Y" or
                                          echo Press Anykey to continue
                                          ECHO if you did. thank you.
                                          PAUSE > NUL

                                          :MENU
                                          CLS

                                          ECHO ============= MENU NAME =============
                                          ECHO -------------------------------------
                                          ECHO 1.  READ ME FIRST
                                          ECHO -------------------------------------
                                          ECHO 2.  Set Logon Wallpaper
                                          ECHO -------------------------------------
                                          ECHO 3.  Selection 3
                                          ECHO -------------------------------------
                                          ECHO 4.  Selection 4
                                          ECHO -------------------------------------
                                          ECHO 5.  Selection 5
                                          ECHO -------------------------------------
                                          ECHO 6.  Selection 6
                                          ECHO -------------------------------------
                                          ECHO 7.  Selection 7
                                          ECHO -------------------------------------
                                          ECHO 8.  Selection 8
                                          ECHO -------------------------------------
                                          ECHO 9.  Selection 9
                                          ECHO -------------------------------------
                                          ECHO ==========PRESS 'Q' TO QUIT==========
                                          ECHO.

                                          SET INPUT=
                                          SET /P INPUT=Please select a number:

                                          IF /I "%INPUT%"=="1" GOTO Selection1
                                          IF /I "%INPUT%"=="2" GOTO Selection2
                                          IF /I "%INPUT%"=="3" GOTO Selection3
                                          IF /I "%INPUT%"=="4" GOTO Selection4
                                          IF /I "%INPUT%"=="5" GOTO Selection5
                                          IF /I "%INPUT%"=="6" GOTO Selection6
                                          IF /I "%INPUT%"=="7" GOTO Selection7
                                          IF /I "%INPUT%"=="8" GOTO Selection8
                                          IF /I "%INPUT%"=="9" GOTO Selection9
                                          IF /I "%INPUT%"=="0" GOTO Selection9

                                          IF /I "%INPUT%"=="q" GOTO Quit

                                          CLS

                                          ECHO ============INVALID INPUT============
                                          ECHO -------------------------------------
                                          ECHO Please select a number from the Main
                                          echo Menu [1-9] or select 'q' to quit.
                                          ECHO -------------------------------------
                                          ECHO ======PRESS ANY KEY TO CONTINUE======

                                          PAUSE > NUL
                                          GOTO MENU

                                          :Selection1
                                          cls
                                          echo.
                                          1>>"%~dp0\temp\error.log" echo started selection 1 reading the read.me year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.
                                          @rem start notepad.exe read.me
                                          echo "read.me", "%~dp0" foo
                                          echo.
                                          echo thank you.
                                          echo Press Any Key when done Reading!
                                          echo.
                                          PAUSE > NUL
                                          Goto Menu

                                          :Selection2



                                          @rem =======begin script UAC PARTUAL DISABLE needed by imageres.dll=============
                                          cls
                                          1>>"%~dp0\temp\error.log" echo -----------------------------------------------------------------
                                          1>>"%~dp0\temp\error.log" echo started selection 2 change logon wallpaper %date:~-4,4%,%date:~-7,2%,%date:~-10,2%,%time:~-11,2% : %time:~-8,2%.
                                          echo processing starts
                                          echo.
                                          1>>"%~dp0\temp\error.log" echo.
                                          echo press anykey
                                          PAUSE > NUL

                                          @rem =======begin script UAC PARTUAL DISABLE needed by imageres.dll=============
                                          echo SET UAC TO DISABLE. To help move imagerers.dll in future may need
                                          ECHO to use reboot to make it better. ???
                                          @rem note: foxidrive noted; I did see that you seem to be trying to disable UAC and that hasn't been
                                          @rem possible by command line to date. There is no way to programmatically disable UAC at this point in time.
                                          @rem selfnote. i only want some of the processes to leave imageres.dll alone. not to fully disable UAC
                                          @rem future note, may need to fully disable UAC. need to think on how to go about returning to script after reboot for that.

                                          1>>"%~dp0\temp\error.log" echo uac temp disable
                                          >>"%~dp0\temp\error.log" 2>&1 "%windir%\System32\reg.exe" ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /f
                                          ECHO.
                                          1>>"%~dp0\temp\error.log" echo.
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end script UAC PARTUAL DISABLE needed by imageres.dll=============


                                          @rem =======begin script kill processes needed by imageres.dll=============
                                          cls
                                          ECHO KILLING PROCESSES NEEDED FOR Modifying imageres.dll
                                          1>>"%~dp0\temp\error.log" echo KILLING PROCESSES NEEDED FOR Modifying imageres.dll
                                          @REM need to make this an if statement if process is running kill it other wise next
                                          @rem for everyone else if you know how to kill processes depening on a curent dll file i would like to know how. thank you.
                                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\taskkill /f /IM "taskmgr.exe"
                                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\taskkill /f /IM "explorer.exe"
                                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\taskkill /f /IM "rundll32.exe"
                                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\taskkill /f /IM "procexp64.exe"
                                          ECHO.
                                          1>>"%~dp0\temp\error.log" echo
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end script kill processes needed by imageres.dll=============


                                          @rem =======begin script Take Ownership of imageres.dll=============
                                          cls
                                          echo Take Ownership of imageres.dll
                                          1>>"%~dp0\temp\error.log" echo taking ownership of imagers file
                                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\TAKEOWN /F "%windir%\system32\imageres.dll"
                                          >>"%~dp0\temp\error.log" 2>&1  %windir%\system32\ICACLS "%windir%\system32\imageres.dll" /GRANT Administrators:F

                                          @rem don't know were i got this or if it is needed but it is here for now.
                                          @rem think when cleaning up script i will test its need.
                                          >>"%~dp0\temp\error.log" 2>&1 SET __COMPAT_LAYER=WINXPSP3
                                          ECHO.
                                          1>>"%~dp0\temp\error.log" echo
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end script Take Ownership of imageres.dll=============



                                          @rem =======begin script Make Backup of imageres.dll=============
                                          cls
                                          echo Make back up of imageres.dll
                                          1>>"%~dp0\temp\error.log" echo make a backup of imageres file
                                          >>"%~dp0\temp\error.log" 2>&1  copy "%windir%\system32\imageres.dll" "%windir%\system32\imageres.dll_%date:~-4,4%%date:~-7,2%%date:~-10,2%%time:~-11,2%%time:~-8,2%.old"
                                          echo make backup from source attempted
                                          ECHO.
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end script Make Backup of imageres.dll=============


                                          @rem =======begin script Move of imageres.dll to working directory=============
                                          cls
                                          echo Copy imagerers file to folder
                                          1>>"%~dp0\temp\error.log" echo copy imagers to local folder
                                          >>"%~dp0\temp\error.log" 2>&1  copy "%windir%\system32\imageres.dll" "%~dp0\"
                                          echo attempted copy imageres file to this folder
                                          ECHO.
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end script Move of imageres.dll to working directory=============


                                          @rem =======begin Clear attributes of imageres.dll to working directory=============
                                          @ i am questioning why i am doing this part of the script?
                                          cls
                                          Echo Clear attributes of imagers file in system folder
                                          2>>"%~dp0\temp\error.log" %windir%\system32\attrib -r -s -h "%windir%\system32\imageres.dll"
                                          pause
                                          echo attrib changed attempted
                                          ECHO.
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end Clear attributes of imageres.dll to working directory=============


                                          @rem =======begin overwrite of imageres.dll to locol directory=============
                                          cls
                                          echo Overwrite image to local file
                                          echo.
                                          @rem the point of this process is to take the picture suplied by the user and ably it to imageres.dll

                                          echo this may take some time pending on you computor processing power
                                          echo is and your usb and/or drive speed is. maybe all the above.

                                          1>>"%~dp0\temp\error.log" echo begin convert of imageres.dll file

                                          set path=%path%;%~dp0

                                          >>"%~dp0\temp\error.log" 2>&1 echo %cd%
                                          1>>"%~dp0\temp\error.log" echo.
                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5031,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo .

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5032,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ..

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5033,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ...

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5034,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ....

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5035,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo .....

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5036,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ......

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5037,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo .......

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5038,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ........

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5039,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo .........["25%"]

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5040,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ..........

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5041,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ...........

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5042,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ............

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5043,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo .............

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5044,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ..............

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5045,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ..............."50%"

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5046,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ................

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5047,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo .................

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5048,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ..................

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5049,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ...................

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5050,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ...................."75%"

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5051,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo .....................

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5052,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ......................

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5053,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo .......................

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5054,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo ........................

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5055,
                                          >>"%~dp0\temp\error.log" 2>&1  copy "imageres1.dll" "imageres.dll" /y
                                          echo........................

                                          >>"%~dp0\temp\error.log" 2>&1  ResHacker.exe -addoverwrite "imageres.dll", "imageres1.dll", "wallpaper.jpg", image, 5056,
                                          echo ........................."100%"

                                          ECHO.
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end overwrite of imageres.dll to locol directory=============

                                          this is were i am haven issues
                                          @rem =======begin Copy of modified imageres.dll to working directory=============
                                          cls
                                          echo OverWrite or Copy modified imageres file back to systems folder
                                          @rem need to make an if then statment that if not replace old file with new file then show error. or take certon actions.
                                          @rem OK, OK. I LOOKED AT THIS AND IT SEEMS THE RIGHT WAY TO MOVE A FILE.
                                          @REM BUT IF THE SYSTEM DOES NOT LET LOOSE OF IT THE COMMAND HAS NO CHOICE BUT TO GIVE ERROR.
                                          @rem i wounder if there is a time limit to when i can modify the file???

                                          1>>"%~dp0\temp\error.log" echo copy back modified emageres.dll file

                                          >>"%~dp0\temp\error.log" 2>&1" copy "imageres.dll" "%windir%\system32\imageres.dll" /y

                                          echo copy attempt of imageres file back to system folder
                                          ECHO.
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end Copy of modified imageres.dll to working directory=============



                                          @rem =======begin of set back ownership of imageres.dll to system directory=============
                                          cls
                                          echo Set Back Ownership of imageres.dll
                                          1>>"%~dp0\temp\error.log" echo set back ownership of file
                                          @rem got to learn some day soon.
                                          echo not set - - - script needing finishing
                                          ECHO.
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end of set back ownership of imageres.dll to system directory=============


                                          @rem =======begin script start processes needed by imageres.dll=============
                                          cls
                                          ECHO STARTING PROCESSES depending on imageres.dll
                                          @REM need to make this an if statement if process was killed then restart it.
                                          1>>"%~dp0\temp\error.log" echo starting processes killed
                                          >>"%~dp0\temp\error.log" 2>&1  start /b explorer.exe >null
                                          >>"%~dp0\temp\error.log" 2>&1  start /b rundll32.exe >null
                                          >>"%~dp0\temp\error.log" 2>&1  start /b procexp64.exe >null

                                          ECHO.
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end script start processes needed by imageres.dll=============



                                          @rem =======begin script UAC PARTUAL ENABLE needed by imageres.dll=============
                                          cls
                                          echo.

                                          echo set UAC to enable
                                          1>>"%~dp0\temp\error.log" echo enable UAC
                                          >>"%~dp0\temp\error.log" 2>&1  %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /f
                                          ECHO.
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end script UAC PARTUAL ENABLE needed by imageres.dll=============


                                          @rem =======begin script cleanup=============
                                          cls
                                          echo.
                                          echo cleanup time
                                          set path=%path%;%~dp0

                                          >>"%~dp0\temp\error.log" 2>&1 echo %cd%

                                          1>>"%~dp0\temp\error.log" echo cleanup time
                                          >>"%~dp0\temp\error.log" 2>&1  move "imagers.dll" "%~dp0\temp"
                                          >>"%~dp0\temp\error.log" 2>&1  move "imagers1.dll" "%~dp0\temp"
                                          ECHO.
                                          echo press anykey
                                          PAUSE > NUL
                                          @rem =======end script cleanup=============

                                          cls
                                          ECHO.
                                          echo Processing Ended
                                          1>>"%~dp0\temp\error.log" echo selection 2 change logon wallpaper ended year%date:~-4,4%,day%date:~-7,2%,month%date:~-10,2%,time%time:~-11,2%,%time:~-8,2%.
                                          1>>"%~dp0\temp\error.log" echo ------------------------------------------------------------------
                                          ECHO.
                                          echo press anykey

                                          PAUSE > NUL
                                          GOTO MENU

                                          :Selection3

                                          cls
                                          @rem idea to go here; is user icon on start menu or login icon setting
                                          echo wait test
                                          CALL :sleep 1
                                          echo 3
                                          echo press anykey
                                          PAUSE > NUL
                                          GOTO MENU

                                          :Selection4

                                          cls
                                          echo 4
                                          echo press anykey
                                          PAUSE > NUL
                                          GOTO MENU

                                          :Selection5

                                          cls
                                          echo 5
                                          echo press anykey
                                          PAUSE > NUL
                                          GOTO MENU

                                          :Selection6

                                          cls
                                          echo 6
                                          echo press anykey
                                          PAUSE > NUL
                                          GOTO MENU

                                          :Selection7

                                          cls
                                          echo 7
                                          echo press anykey
                                          PAUSE > NUL
                                          GOTO MENU

                                          :Selection8

                                          cls
                                          echo 8
                                          echo press anykey
                                          PAUSE > NUL
                                          GOTO MENU

                                          :Selection9

                                          cls
                                          echo 9
                                          echo press anykey
                                          PAUSE > NUL
                                          GOTO MENU

                                          :Quit
                                          CLS

                                          ECHO ==============THANKYOU===============
                                          ECHO -------------------------------------
                                          ECHO ======PRESS ANY KEY TO CONTINUE======

                                          1>>"%~dp0\temp\error.log" echo =======================================================================
                                          1>>"%~dp0\temp\error.log" echo --------------------------end of batch script--------------------------

                                          move "%~dp0\temp\error.log" "%~dp0\temp" >nul

                                          PAUSE>NUL
                                          EXIT

                                          snowcatman

                                            Topic Starter


                                            Beginner

                                            • Experience: Beginner
                                            • OS: Windows 8
                                            Re: batch file logging windows 7 home how to question
                                            « Reply #35 on: March 12, 2014, 11:06:18 AM »
                                            FOR THOSE JUST LEARNING THIS MAY BE HELPFUL TOO YOU
                                            O'k here ;D
                                            I stumbled onto something in my learning's. Thought I would share with the world right here

                                            Yes in my head account's, and thoughts.. sorry I am a bad speller!

                                            Here I am looking and wondering why I keep getting errors I log and set my path and yet it's
                                            like I am not making the right commands or something!
                                            so I go back and am trying to pick up on anything that might make cents.

                                            why did I need to set path? I just over looked this and thought well if I set it then I am working in it. right?
                                            Wrong!!!
                                            i did a
                                            set path=%~dp0\
                                            and foxidrive set me strait.
                                            set path=%path%;%~dp0
                                            but i don't think i made myself very clear that i was running this in owner administrator and useing cmd in administrator mode.
                                            idk maybe i did... but here is what i put together

                                            >>"%~dp0\temp\error.log" 2>&1 set path=%path%;%~dp0
                                            nothing is in the log about it ether

                                            then i do something like this, put remember i am not getting what i am expecting so i am going the extra mile.

                                            >>"%~dp0\temp\error.log" 2>&1  copy "%windir%\system32\imageres.dll" "%windir%\system32\imageres.dll_%date:~-4,4%%date:~-7,2%%date:~-10,2%%time:~-11,2%%time:~-8,2%.old"

                                            or

                                            >>"%~dp0\temp\error.log" 2>&1  copy "%windir%\system32\imageres.dll" "%~dp0\"

                                            do you see what i am doing. i am being very specific were i want my files. why are you doing that snowcatman?

                                            well thank you foxidrive? for teaching me about logging. i keeped wondering why i keeped getting errors. and so i keeped adding more logging. then i wanted too. i keep trying to be more exact and trying to get it right.

                                            so i keeped going back and looking at all the code in the batch file. looking at this site and low and behold i am searching google too.

                                            not thinking common cents. sorry the Oakey in me. lol

                                            So I finally did a search with these words: "batch file default directory". thinking i must be reschooled right? I was thinking what is my directory and so earlier i was doing this too.

                                            @rem----------idea know my path--------------------
                                            >>"%~dp0\temp\error.log" 2>&1 echo path is %cd%
                                            @rem-----------------------------------------------

                                            and in the log i find this. and with this information it hit me harder then someone throwing a rock my way, hitting a tin roof.
                                            the light had finally lit.

                                            path is C:\Windows\system32

                                            why was i seeing this all the time. i know i set my path right?
                                            and that web page i stumbled on:

                                            http://shortfastcode.blogspot.com/2012/07/running-bat-file-as-administrator.html

                                            now i know there is a link from this site that must say the same thing. but i was just doing my ussual search find and ask questions later thing.

                                            so when starting my script i need to:

                                            @SETLOCAL ENABLEEXTENSIONS
                                             @cd /d "%~dp0"

                                            so to learn the birds and the bee's of batch scripting bun intended. lol

                                            this is the first little chunk of my script. added the lines after i did a quick check from my dos mode script

                                            @rem logonwallpaper.bat
                                            @ECHO OFF
                                            @SETLOCAL ENABLEEXTENSIONS

                                            @cd /d "%~dp0"
                                            @rem----------idea know my path--------------------
                                            >>"%~dp0\temp\error.log" 2>&1 echo  path is %cd%
                                            @rem-----------------------------------------------
                                            set path=%path%;%~dp0
                                            >>"%~dp0\temp\error.log" 2>&1 echo path is %cd%

                                            i can now show you the differences of my logging and what in pack of adding those few commands to the beginning of my script did
                                            BEFORE
                                            -------------------------begining of batch script-------------------------
                                            ==========================================================================
                                            started personal branding script year2014,day12,month03,time 9,01.
                                            ==========================================================================
                                             path is C:\Windows\system32
                                            --------------------------------------------
                                            Selection3 For DOS Safe mode - more reliable
                                            --------------------------------------------

                                            path is C:\Windows\system32

                                            dos mode uac temp disable
                                            The operation completed successfully.


                                            if you read thus far, you will notice alot of other changes too. hope you got something out of this. thank you.


                                            taking ownership of imagers file

                                            SUCCESS: The file (or folder): "C:\Windows\system32\imageres.dll" now owned by user "snowballs\a".

                                            processed file: C:\Windows\system32\imageres.dll
                                            Successfully processed 1 files; Failed processing 0 files


                                            make a backup of imageres file
                                                    1 file(s) copied.
                                            copy imagers to local folder
                                                    1 file(s) copied.
                                            begin convert of imageres.dll file
                                            path is C:\Windows\system32
                                            path is C:\Windows\system32
                                            C:\Windows\system32

                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            copy back modified emageres.dll file
                                            The filename, directory name, or volume label syntax is incorrect.
                                            set back ownership of file
                                            enable UAC
                                            The operation completed successfully.

                                            C:\Windows\system32
                                            C:\Windows\system32
                                            cleanup time
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            selection 2 change logon wallpaper ended year2014,day12,month03,time 9,02.
                                            ------------------------------------------------------------------
                                            =======================================================================
                                            --------------------------end of batch script--------------------------

                                            AFTER
                                            -------------------------begining of batch script-------------------------
                                            ==========================================================================
                                            started personal branding script year2014,day12,month03,time 9,31.
                                            ==========================================================================
                                             path is G:\BATCH.START
                                            --------------------------------------------
                                            Selection3 For DOS Safe mode - more reliable
                                            --------------------------------------------

                                            path is G:\BATCH.START

                                            dos mode uac temp disable
                                            The operation completed successfully.


                                            taking ownership of imagers file

                                            SUCCESS: The file (or folder): "C:\Windows\system32\imageres.dll" now owned by user "snowballs\a".

                                            processed file: C:\Windows\system32\imageres.dll
                                            Successfully processed 1 files; Failed processing 0 files


                                            make a backup of imageres file
                                                    1 file(s) copied.

                                            copy imagers to local folder
                                                    1 file(s) copied.
                                            begin convert of imageres.dll file
                                            path is G:\BATCH.START
                                            path is G:\BATCH.START
                                            G:\BATCH.START

                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                                    1 file(s) copied.
                                            copy back modified emageres.dll file
                                            The filename, directory name, or volume label syntax is incorrect.
                                            set back ownership of file
                                            enable UAC
                                            The operation completed successfully.

                                            G:\BATCH.START
                                            G:\BATCH.START
                                            cleanup time
                                            The system cannot find the file specified.
                                            The system cannot find the file specified.
                                            selection 2 change logon wallpaper ended year2014,day12,month03,time 9,33.
                                            ------------------------------------------------------------------
                                            =======================================================================
                                            --------------------------end of batch script--------------------------