1.

Solve : batch file logging windows 7 home how to question?

Answer» Squashman

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.Quote from: snowcatman on MARCH 11, 2014, 06:54:59 AM
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.



Quote from: Squashman 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/

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.
foxidrive

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..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
EXITFOR THOSE JUST LEARNING THIS MAY BE HELPFUL TOO YOU
O'k here
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--------------------------


Discussion

No Comment Found