Category: Windows

Can not open chm file from network drive

Problem: chm file can be opened locally but not from network drive. Might be an IE7 or windows security patch problem?

Change registry:


from MS support solution 2

I used to have a “MaxAllowdZone = 2”, which means opening chm file from internet is not allowed. After changing it to 3, problem went away.

For some reason, this value comes back to default value 2 everyday on my workstation. Might because our company’s policy, so I created a batch file to re-set it on my startup.

reg add HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions /v MaxAllowedZone /t REG_DWORD /d 3 /f

Using DOS command to Auto-Pick today’s wallpaper

I wish this image converter tool can support command-line mode, so I could make my little tiny wallpaper changer bat file more powerful.

::== randomSetWallpaper.bat
@echo off
setLocal EnableDelayedExpansion
set ImageDir=”I:\My Documents\My Pictures\wallpaper\”
set ImageList=!ImageDir!”*.bmp”
:: This might be different on each machine.
set ImageOfToday=”C:\Documents and Settings\TEMP\Local Settings\Application Data\Microsoft\Wallpaper1.bmp”
for /f %%A in (‘dir /b !ImageList!^|find /v /c “\”‘) do set C=%%A
::set R=!random:~-3!
:: %RANDOM% – expands to a random decimal number between 0 and 32767.
:: Here we only need 3 digitals, the tolal number of files won’t be greater than 999.
set R=!random:~-100!
if !R! gtr !C! goto :loop
if !R! equ 0 goto :loop
for /f “tokens=*” %%A in (‘dir /b !ImageList!’) do (
set /a N+=1
rem Step by step to find the marked point. !R! ( !N! is adcting as an indicator.)
rem The /A switch specifies that the string to the right of the equal sign is a numerical expression that is evaluated.
if !N! equ !R! copy !ImageDir!%%A !ImageOfToday! && goto :eof
rem an extra doulbe quote seems OK here.
goto :eof

It works, but, what a pity I had to convert all the images to bmp format in advance!

Another drawback is, this NEW wallpaper won’t be in effect until next time login, because I don’t know how to refresh the desktop settings.

The purpose of ‘setLocal EnableDelayedExpansion‘:

if you want the variable to be expanded at execution time rather than at parse time? For that, you use “delayed expansion”, which is enabled by the /V command line option or by using the SETLOCAL ENABLEDELAYEDEXPANSION command in a batch file.

-from The old new thing.