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 deniedin 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" /yecho 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