//利用IMDISK 生成一个 100M 的Z:盘作为 IE缓存，可多个IE 共享。 
TEAM ENVI^ EnviMode=1| ENVI^ ForceLocal=1
SET &DISKM=100  //100M

IFEX PE_DEBUG.LOG, LOGS * PE_DEBUG.LOG 
SET &INITRAM=0
IFEX Z:\,! TEAM SET INITRAM=1| RAMD ImDisk,L%DISKM%,FAT32,z:,ImD_IE
SET-env  &SystemDrive=%SystemDrive%
SET-env  &USERNAME=%USERNAME%

ENVI TEMP=Z:\TEMP\
ENVI TMP=Z:\TEMP\
MDIR  Z:\TEMP
MDIR  Z:\IECACHE\%USERNAME%\TemporaryInternetFiles
TEAM  SET &CacheNum=| SET &Cache=| SET &pid=0
{  LOCK #pecmd 
REGI $HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\CacheNum,CacheNum
IFEX $1=%INITRAM%, SET CacheNum=0
CALC #CacheNum=%CacheNum% + 0
IFEX $%CacheNum%<0, SET CacheNum=0
CALC #&CacheNum=%CacheNum% + 1

REGI $HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\CacheNum=%CacheNum%
REGI $HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Cache,Cache
REGI $HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Cache=Z:\IECACHE\%USERNAME%\TemporaryInternetFiles
EXEC --pid:&pid "%SystemDrive%\Program Files\Internet Explorer\iexplore.exe"
}
WAIT 1000
FIND $%&Cache%=,!  REGI $HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Cache=%Cache%
WAIT *%pid%   //等待其结束 

{ LOCK #pecmd 
REGI $HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\CacheNum,&CacheNum
CALC #&CacheNum=%CacheNum% + 0
CALC #&CacheNum=%CacheNum% - 1
IFEX $%CacheNum%<0, SET CacheNum=0
REGI $HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\CacheNum=%CacheNum%
IFEX $%CacheNum%<1, RAMD ImDisk*    -D   -m Z:  //卸载 
  
}


