Laurent Duchastel

[UP]

This is a text version of laurent's ZTW.ZAM file


ZTreeMenu             2004-06-10 14:45


[-] Collapse tree to hide scripts

|--LAURENT'S MENU version 2004-06-09
type %0 | more
pause
exit
Author: Laurent Duchastel
Contact: laurent.duchastel@hec.ca

HISTORY
--------
(between updates on the Ztree Application Menu Library at
http://vujnovic.free.fr/ztw/ztw_menu_lib.html

2004-06-09
Removed   - All "secondary" batch techniques and complex coding (echo,
            pipe and DTNV), thanks to NEW Ztree feature Alt-X (Many thanks Kim!)
Added     - RAR & ZIP, new console version, unified menu, and default option
            for GUI/Console
Added     - Par2 console scripts with unified menu
Added     - Compressing <branch> Usenet-Style
Modified  - Final archiving
Modified  - MD5/SFV variantes now in one unified menu
Modified  - Import/Export database in one unified menu
Modified  - Adobe Acrobat tweak in one unified menu
Modified  - PKZIPC registration script in one unified menu
Modified  - Ztree environment variables & shortcut in one unified menu
Modified  - Checking /? or /h use MORE
Modified  - m3u playlist scripts are ANSI compliant
Modified  - Error-handling in many scripts (ex: extension, Ztree context, etc)
Modified  - Some scripts handle tagged files in small number
Modified  - Network specifications to reflect changes in my network
Added     - Use of ::Private and ::Private Tree tags on some private scripts
            (not seen)
Added     - FAVORITES folder, where I COPY the most frequently used
            scripts (not seen)
Added     - Proprietary marker :://flag// to keep track of same
            technic used in some scripts (easier maintenance when code change)
Added     - Standardized "code clips" for various functions, available using
            PSPad text editor
Modified  - Database's hierarchy
Revised   - Major rewriting of all code, content, and formatting,
            taking advantage of a new text editor PSPad (http://www.pspad.com)
            with syntax highlightening and code clip insertion feature
Commented - Switch database "official script"
Commented - Extended documentation in almost all scripts
Removed    - Tips and doc on batch, F9, tips, etc.
            ** NOW in a new database **

2004-04-06
Stolen    - Many scripts and sections from Ben Kent and Slobodan Vujnovic
            menus (I happily took what I found useful for my own use !)
            Thanks guys !
Added     - Some tips and doc about batch creation
Added     - Extensive documentation and formatting
Added     - Add and Delete Ztree variables: ZTEMP, XPATH, DPATH, PATH,
            shortcut (2 x 2 versions available)
Added     - Trash the current drive trashcan !
Added     - Clean Windows history and temporary files in SAFE mode
Added     - Generic switch ZDB database script (developed by Ben)
Added     - My own "load ZDB databases" script (experimental)
Modified  - Many scripts to use a character substitution batch trick to
            generate unique batch name that can be launch simultaneously
Modified  - Ztree export to HTML, added personalization options
Modified  - Generic Windows Start submenus creation
Modified  - Screen resolutions scripts use now NirComLine utility
Modified  - Temporary playlist do not require MSUB anymore

2004-03-24
Added     - Export Menu to HTML
Added     - Send file in Outlook email
Fixed     - Generic Windows Start submenus
|  |--ABOUT Laurent's database
type %0 | more
pause
exit

+----------------------------------------------------------------+
|                                                                |
|  M   MMM   MM  MMM   MMMMMM  MM   MM MM MM   MM   MMMM     MM  |
|  M   MMM   MM  MMM   MM   MM MMM  MM MM MMM  MM  MM  MM    MM  |
|  MM MMMMM MM  MM MM  MM   MM MMM  MM MM MMM  MM MM         MM  |
|  MM MM MM MM  MM MM  MM   MM MMMM MM MM MMMM MM MM         MM  |
|  MM MM MM MM  MM MM  MMMMMM  MM M MM MM MM M MM MM  MMM    MM  |
|  MM MM MM MM  MM MM  MM  MM  MM MMMM MM MM MMMM MM   MM    MM  |
|   MMM   MMM  MMMMMMM MM   MM MM  MMM MM MM  MMM MM   MM        |
|   MMM   MMM  MM   MM MM   MM MM  MMM MM MM  MMM  MM  MM    MM  |
|   MMM   MMM  MM   MM MM    MMMM   MM MM MM   MM   MMMM     MM  |
|                                                                |
+----------------------------------------------------------------+

This is my collection of scripts. Some are from me, many are from other
contributors.

This database is a work-in-progress. Some scripts are still experimental or
even beta and might be buggy. All scripts work for me, but none have been
tested on other systems than mine. Please review the code of entry before
running it, backup up your data and test on dummy data or dir first.

I am not an administrator nor a programmer, just a power user. Therefore my
collection reflects that status. Other "F9 masters", like Slobodan Vujnovic and
Ben Kent have developed very nice scripts more oriented toward technical or
administrative contexts. Please explore their database if you are interested in
such use.

Whenever script's length or complexity justified it, I tried as much as possible
to track credits of original contributor(s), even if I sometime took the liberty
to adapt the script. As far as my scripts are concerned, I don't give a damn
about putting my own credit and you can take them and modify as much as you want.
However, I included a "version" headline for medium-size scripts. It may like
presomptious, but it is only for tracking purpose.

WW   W   WW WW             WW     WW WWWWWW
WW   W   WW WW              WW   WW  WWWWWWW
WW  W W  WW                  WW WW   WW   WW
 WW W W WW  WW  WW WW        WW WW   WW   WW
 WW W W WW  WW  WWWWWW        WWW    WW   WW
 WW W W WW  WW  WW  WW        WWW    WWWWWWW
 WW W W WW  WW  WW  WW        WWW    WWWWWW
 WW W W WW  WW  WW  WW       WW WW   WW
  WW   WW   WW  WW  WW       WW WW   WW
  WW   WW   WW  WW  WW      WW   WW  WW
  WW   WW   WW  WW  WW     WW     WW WW

1) All scripts were tested on a French Windows XP. All computers around me are
French Windows XP so it's difficult for me to care about compatibility with
other versions or localization of Windows. Even if most scripts will work
on Win9x or NT (although I cannot say which ones), they were developed with
Win XP in mind. This means that I didn't included any OS error handlers in my
scripts.

2) Some scripts use tricks found exclusively in Windows NT/2K/XP extended
command processors. For those using Win9x, it seems there is a free command
processor enhancer called Win95cmd developed by Microsoft. Never tested myself
but I read it emulates NT/2K/XP tricks. See
http://www.nc5.infi.net/~wtnewton/batch/fixcmd.htm for more.

3) I don't care much about temporary BAT leftovers in ZTTemp. This directory
is usually deleted when Ztree quits anyway.

4) Even with Ztree being at the center of my daily computing, I still use the
mouse and the Windows interface ! :-) I find many operations more convenient to
launch with Windows regular interface than with F9. Therefore I try to be
selective, not exhaustive, in what I add in my menu, and do not try to
replicate every shortcut or command that could be included in the Windows Start
Menu, for instance.

5) Even if I prefer pure batch language solutions, for some operations I really
need to use external utilities. As much as possible, I favor small and console-
based freeware.

Summary of all external utilities used here
============================================

FREE
====
CDisplay, http://www.geocities.com/davidayton/CDisplay
Choice.exe, http://www.usfamily.net/web/wpattinson/wildeware/util/choice.zip
DCOMP32, http://www.datman.com/
FSUM, http://www.slavasoft.com/fsum/
MAPIMAIL, http://say.city.tomsk.net/soft_e.htm
MSUB, http://home.inbound.dk/~andersjm/provide/msub
NirComLine, http://freehost14.websamba.com/nirsoft/utils/nircomline.html
OEM2ANSI, http://www2.mikro.biologie.tu-muenchen.de/rs/soft/Soft.html
REGFREE.EXE, http://www.jsiinc.com/SUBA/tip0100/rh0170.htm
PAR2.EXE, http://sourceforge.net/project/showfiles.php?group_id=30568&package_id=82331
rpVT, http://www.rpvt.com/
Shortcut.EXE, http://www.optimumx.com/
SystemInfo utility, http://wpattinson.com/JimWilson.zip
V3 viewer, http://wpattinson.com/JimWilson.zip
ZIP/UNZIP, http://www.info-zip.org/pub/infozip/
ZTWMenuText.vbs, http://www.ztw3.com/upfile/ZTWMenuText.zip

SHAREWARE
==========
PKZIP 6.0, http://www.pkware.com
VIEW viewer, http://mdrury.hypermart.net/index.html
WinRAR, http://www.rarsoft.com
|  |--ZTREE Maintenance
|  |  |--Switch database with Menu                        [CTRL-ENTER]
:: Purpose  : Swaps the current menu file for the selected one
::          :
:: Submitter: Ben Kent
:: Modified : 28 May 2004, Laurent Duchastel for header comments only
:: Requires : a) Windows NT/2K/XP
::          : b) CMD.exe to be the shell
::          : c) Choice.exe, Walt's version
::          :     http://www.usfamily.net/web/wpattinson/wildeware/util/choice.zip
::          :     (the script was tested against the MS-DOS 6.22 version)
:: Note1    : ZDB databases are actually ZTW.ZAM files developed by other users.
::          : Other databases must be in the ZTree directory and named *.ZDB
:: Note2    : Need to run with Ctrl-Enter so that the menu closes before the new
::          : file is written assuming that CO-3S=No (F9 Menu - Closes menu after executing)
:: Note3    : On first run the existing menu file is backed up to _Standard.ZDB
::-----------------------------------
if Not [%OS%]==[Windows_NT] goto End
If "%%1"=="FILECOPY" goto FileCopy

REM Make sure that CMD extensions are enabled
SetLocal EnableExtensions
SetLocal EnableDelayedExpansion

REM Generate the menu
Set _Choices=ABCDEFGHIJKLMNOPQRSTUVWXYZ
Set _Index=0
Echo Available menu files
for %%%%I In (#ZTHome\*.ZDB) do call :MenuItem %%%%~nI
Echo.
If [%_Index%]==[0] goto NoneFound
If %_Index% GTR 26 Set _Index=26

REM Display the choices and process the selected item
Set _Choices=0!_Choices:~0,%%_Index%%!
Choice /C:%_Choices% Select file, or Zero to quit :

REM guard against choice not being found
If [%_Index%]==[0] goto :Exit
Set /a _Index=%ErrorLevel% - 1

REM Quit if Zero was chosen
If [%_Index%]==[0] goto :Exit

REM Calculate the file that was selected
Set _C=!_Choices:~%_Index%,1!
Set _File=!_File%%_C%%!

REM Get the previous file name if there was one
Set _LastMenuFile=
If Exist #ZTHome\_LastMenuFile.cmd Call #ZTHome\_LastMenuFile.cmd

REM If there was not a previous file, use _Standard as the name
If [%_LastMenuFile%]==[] Set _LastMenuFile=#ZTHome\_Standard.ZDB

REM Call this batch file Async, so that the menu can be closed before the files are copied
REM This is likly to be behind the ZTreeWin window, so you may need to Alt-Tab
Start %ComSpec% /c "%%0" FILECOPY
goto :eof

REM Now do the copy
:FileCopy
  Title ZTreeWin Menu copy
  Echo About to copy files, ensure that the ZTreeWin menu is closed
  Echo.
  Echo   #ZTHome\ZTW.ZAM To %_LastMenuFile%
  Echo   #ZTHome\%_File%.ZDB To #ZTHome\ZTW.ZAM
  Echo.
  Echo Press ^^C to break or
  Pause
  Copy /y #ZTHome\ZTW.ZAM %_LastMenuFile%
  REM Save the previous file name
  Echo Set _LastMenuFile=#ZTHome\%_File%.ZDB>#ZTHome\_LastMenuFile.cmd
  Copy /y #ZTHome\%_File%.ZDB #ZTHome\ZTW.ZAM
  Echo.
  Echo Done.
  Pause
goto :eof

:MenuItem
  Set _C=!_Choices:~%_Index%,1!
  Set _File%_C%=%%~n1
  echo   %_C%  %%~n1
  Set /a _Index=_Index+1
goto :eof

:NoneFound
  Echo No *.ZDB files found in #ZTHome
  pause
goto :eof

:Exit
  Echo Exit
goto :eof
:End
|  |  |--Import/Export current database                   [EXIT F9 ONCE BEFORE OR CTRL-ENTER]
:: Purpose  : Imports/Exports current database to/from ZTW.TXT, overwriting
::          : any previous file
:: Version  : 1.0
:: Requires : ZTWMenuText.vbs http://www.ztw3.com/upfile/ZTWMenuText.zip
::            VERSION 1.0.0.9 or later
::            must be located in ZTHome
::-----------------------------------

:: #ZTSet _OPERATION 1:Export ASCII  2:Export ASCII (filtered) 3:Import ASCII
If [%_OPERATION%]==[] goto Export
If [%_OPERATION%]==[1] goto Export
If [%_OPERATION%]==[2] goto Export_Filter
If [%_OPERATION%]==[3] goto Import
goto exit

:Import
echo This command need to be launched with CTRL-ENTER, not Enter, so that the menu closes
echo before the exported file is written.
echo (Assuming that CO-3S=No, F9 Menu - Closes menu after executing)
echo.
echo WARNING ! This script overwrite the current F9 menu. Please check that you are
echo importing the good ASCII file.
echo.
echo For safety purpose, a backup of the current database will be created as
echo   #ZTHome\ZTW.ZAM
echo before the conversion takes place.
echo.
echo Press Ctrl-Break to interrupt this command or
pause
copy /Y #ZTHome\ZTW.ZAM #ZTHome\ZTW.BAK
start #ZTHome\ZTWMenuText.vbs /P /Z "#ZTHome\ZTW.TXT" "#ZTHome\ZTW.ZAM"
goto exit

:Export
echo Before running this item, you should have exited the F9 menu at least once
echo if any changes were made to the database, otherwise the older version of
echo the database will be converted, not the most recent one.
echo.
echo You can continue safely if no changes were made.
echo.
echo Press Ctrl-Break to interrupt this command or
pause
:: The file name is the default one (ZTW.TXT)
#ZTHome\ZTWMenuText.vbs /A "#ZTHome\ZTW.ZAM" "#ZTHome\ZTW.TXT"
:: Comment the line below if you don't want to automatically launch your
:: default text editor
start #ZTHome\ZTW.TXT
goto exit

:Export_Filter
echo Before running this item, you should have exited the F9 menu at least once
echo if any changes were made to the database, otherwise the older version of
echo the database will be converted, not the most recent one.
echo.
echo You can continue safely if no changes were made.
echo.
echo This script will produce a filtered ASCII version of the database. All scripts
echo starting with ::Private, ::PrivateTree or ::Duplicate will be filtered.
echo Beware NOT TO IMPORT BACK this version over the current database without
echo proper previous backup, otherwise all personnal scripts will be lost forever.
echo.
echo Press Ctrl-Break to interrupt this command or
pause
#ZTHome\ZTWMenuText.vbs /A /P /F "#ZTHome\ZTW.ZAM" "#ZTHome\ZTW.TXT"
:: Because this script is usually used to create a "public" version of the
:: database, no editing is usually required by default, but if you want so,
:: uncomment the line below
:: start #ZTHome\ZTW.TXT
goto exit
|  |  |--Export database to HTML with personalization     [EXIT F9 ONCE BEFORE]
:: Purpose  : Exports the current ZTree menu file to a Web file
:: Version  : 1.0
:: Requires : ZTWMenuText.vbs http://www.ztw3.com/upfile/ZTWMenuText.zip
::            VERSION 1.0.0.9 or later
::            must be located in ZTHome
::-----------------------------------
REM #ZTSet _SUFFIXNAME Suffix for file name (typically your firstname)
REM #ZTSet _MENUHEADER HTML menu Header (typically your full name")
echo Before running this item, you should have exited the F9 menu at least once
echo if any changes were made to the database, otherwise the older version of
echo the database will be converted, not the most recent one.
echo.
echo You can continue safely if no changes were made.
echo.
echo This script will produce a filtered Web version of the database. All scripts
echo starting with ::Private, ::PrivateTree or ::Duplicate will be filtered.
echo.
echo Press Ctrl-Break to interrupt this command at this point or press any
echo other key to continue
echo.
pause
#ZTHome\ZTWMenuText.vbs /F /W /N:"%_SUFFIXNAME%" /T:"%_MENUHEADER%" "#ZTHome\ZTW.ZAM" "#ZTHome"
:: Open the primary web file in the default browser
start #ZTHome\ztw_%%_SUFFIXNAME%%1.html
|  |  |--Ztree /O occurrence (debug OEM/ANSI issues)
:: Purpose  : Start a second Ztree occurrence in current directory
::          : with the /O switch when OEM translation occurs. This allows
::          : quickly fixing a file name that cause problem
#ZThome\#ZTexe /O %2:%3
|  |  |--Add/Remove PATH,ZTEMP,shortcut,(DPATH,XPATH)in User Environnement (utilities version)
:: Purpose   : Add/remove permanent Ztree environment variables and shortcut in
::           : User environment
:: Version   : 1.0
:: Note      : This script use two external utilities. I couldn't find a batch-only way to
::           : create the Ztree shortcut and to add a path to current user path in the registry
::           : REGFREE.EXE, http://www.jsiinc.com/SUBA/tip0100/rh0170.htm
::           : NirComLine, http://freehost14.websamba.com/nirsoft/utils/nircomline.html

:: #ZTSet _INSTALLMODE 1:Install  2:Uninstall
IF [%_INSTALLMODE%] ==[1] goto Install
IF [%_INSTALLMODE%] ==[2] goto Uninstall
goto exit

:Install
:: Add Ztree directory to the path
#ZTHome\REGFREE.EXE -EnvPathAdd #ZThome

:: Ztree uses the %TEMP% directory by default. However, if the ZTEMP variable
:: is defined, Ztree will use that location instead to create its ZTEMPnnn
:: directory (one for each instance of Ztree)
:: I prefer to use the Ztree location. This is suitable only if Ztree directory
:: is writable (not being on CDROM for instance), but change or uncomment to your
:: taste.
#ZTHome\REGFREE.EXE -Set \User\Environment\ZTEMP="#ZTHome"

:: XPATH and DPATH are underdocumented but are basically alternate
:: locations where Ztree look for a program. Ztree searches in the
:: following order:
::
::      1. current dir
::      2. ZTW.EXE dir
::      3. PATH
::      4. DPATH
::      5. XPATH
::
:: These alternate paths can be used to point library of utilities
:: (like C:\My utilities), or point a useful program (like C:\Program
:: Files\WinZip).
:: Because there are not used commonly, these entries below are disabled by default.
:: To enable them, just uncomment the lines.
::
REM #ZTHome\REGFREE.EXE -Set \User\Environment\DPATH=C:\YourPath
REM #ZTHome\REGFREE.EXE -Set \User\Environment\XPATH=C:\YourPath

:: Add Ztree shortcut(s)
:: Arguments for ZTREE.EXE can be adjust to your taste! See ZTREE Help for more.
:: Location of shortcut can also be adjust to your taste! See NirComLine Help for more.
#ZTHome\NirComLine shortcut "#ZTHOME\#ZTEXE" /programs "Ztree Win" "/Y /ZB /ZP /SO /T~q %%%USERNAME%%% on %%%COMPUTERNAME%%%~q
echo Environment variables will be effective at next logon
pause
goto exit

:Uninstall
#ZTHome\REGFREE.EXE -Deletevalue \User\Environment\Ztemp
#ZTHome\REGFREE.EXE -EnvPathDelete #ZThome
:: Nothing happen if the two keys below are not found, so the lines can be left uncommented
#ZTHome\REGFREE.EXE -Deletevalue \User\Environment\DPATH
#ZTHome\REGFREE.EXE -Deletevalue \User\Environment\XPATH

:: Unfortunately, I don't know how to delete the shortcut previously created because
:: /programs location is OS language-dependant. Therefore the location must be
:: hard-coded. :-( Alternatively, the shortcut can be delete by hand.
:: Note that if the command below does not find the shortcut or the folder,
:: nothing wrong happen.
Del /Q "%USERPROFILE%\Start menu\Programm\Ztree Win.lnk"
Del /Q "%USERPROFILE%\Menu D‚marrer\Programmes\Ztree Win.lnk"
goto exit
|  |--WINDOWS COMMANDS
|  |  |--Windows Explorer [file|dir]
:: Purpose  : Open Windows Explorer
::-----------------------------------
:: Reference
:: For Win9x, http://support.microsoft.com/support/kb/articles/Q130/5/10.asp
:: For NT/2K, http://support.microsoft.com/support/kb/articles/152/4/57.asp
::
:: Explorer [/n] [/e] [(,)/root,<object>] [/select,<object>]
::
:: /n                Opens a new single-pane window for the default
::                   selection. This is usually the root of the drive Windows
::                    is installed on. If the window is already open, a
::                   duplicate opens.
:: /e                Opens Windows Explorer in its default view.
:: /root,<object>    Opens a window view of the specified object.
:: /select,<object>  Opens a window view with the specified folder, file or
::                   application selected.
start "" explorer.exe /n,/e,/select,""%1"
|  |  |--Diskcopy
:: Purpose  : Launch native diskcopy utility
:: Note     : Only drives with disks inserted are displayed
::-----------------------------------
start rundll32 diskcopy.dll,DiskCopyRunDll 0
|  |  |--Lock the computer
:: Purpose  : Same as Ctrl-Alt-Del,Lock
:: Submitter: Michael Kahn
::-----------------------------------
rundll32 user32.dll,LockWorkStation
|  |  |--Test <file> for presence of help and switches (/? and /h)
:: Purpose   : Execute current executable with commonly found /? switch
:: Version   : 1.0
::           : to see if there is any other documented switch
::-----------------------------------
:: Check if current Ztree view is Dir
REM #ZTIfDir SET _ZTMODE=Dir
IF [%%_ZTMODE%%]==[Dir] GOTO Err_NoDir
::Check if file has appropriate extension. Add other extensions as required.
IF /i [%5]==[exe] goto Good_Ext
IF /i [%5]==[com] goto Good_Ext
IF /i [%5]==[vbs] goto Good_Ext
IF /i [%5]==[bat] goto Good_Ext
IF /i [%5]==[cmd] goto Good_Ext
:: If Win9X, the /i doesn't work. You must therefore type all lower/uppercase
:: variation !
exit

:Good_Ext
%1 /? | more
pause
:: Some utilities do not show help with /? (and vice-versa) so another switch is
:: used, but other utilities work with both switches, so you may end with double display.
%1 /h | more
pause
exit

:Err_NoDir
exit
|  |--APPLICATIONS
|  |  |--OpenWith <file>
:: Purpose  : Open the file with alternate associations
:: Note     : Same as Open With in Windows Explorer file context
::-----------------------------------
:: Check if current Ztree view is Dir
REM #ZTIfDir SET _ZTMODE=Dir
IF [%%_ZTMODE%%]==[Dir] GOTO Err_NoDir
start RUNDLL32 SHELL32.DLL,OpenAs_RunDLL %1
exit
:Err_NoDir
exit
|  |  |--Send <file> by email (with Outlook)
:: Purpose  : Create new mail in Outlook with current file as attachment
:: Requires : Outlook
:: Note     : Edit path to executable's location
::-----------------------------------
:: Check if current Ztree view is Dir
REM #ZTIfDir SET _ZTMODE=Dir
IF [%%_ZTMODE%%]==[Dir] GOTO Err_NoDir
start "" "%ProgramFiles%\Microsoft Office\Office10\OUTLOOK.EXE" /A %1
exit
:Err_NoDir
exit
|  |  |--Send <file> by email (with MAPIMAIL)
:: Purpose  : Create new mail in default MAPI mail client with current file as
::          : attachment
:: Requires : MAPIMAIL (free), http://say.city.tomsk.net/soft_e.htm
::-----------------------------------
:: Check if current Ztree view is Dir
REM #ZTIfDir SET _ZTMODE=Dir
IF [%%_ZTMODE%%]==[Dir] GOTO Err_NoDir
start "" #ZTHome\MAPIMAIL.EXE %1
exit
:Err_NoDir
exit
|  |  |--Open <tagfiles> with Notepad
:: Purpose  : Emulate Ztree's Ctrl-Edit with Notepad
::          : Notepad can't open more than one document at a time
::          : A new occurence of Notepad must be launched for each document
::-----------------------------------
REM #ZTTag #ZTTemp\~ZTTag.bat -fStart %SYSTEMROOT%\notepad.exe %1
CALL #ZTTemp\~ZTTag.bat
|  |  |--Open <tagfiles> with in alternate text editor
:: Purpose  : Emulate Ztree's Ctrl-Edit with any alternate text editor
::          : Only Ztree's primary text editor (CO-1A) is used with Ctrl-Edit
:: Note     : Edit executable and path for your own editor
::-----------------------------------
REM #ZTTag #ZTTemp\~ZTTag.bat -f#ZTHome\PSPad\PSPad.exe %1
CALL #ZTTemp\~ZTTag.bat
|  |  |--Acrobat 5.0 PDFMaker tweak
:: Purpose   : Disable / Enable annoying PDFMaker 5.0 on Office XP
::           : This add-in from Acrobat 5.0 really bugs me. Even it isn't
::           : installed on first installation, the upgrade pack add it.
::           : PDFMaker is seldom used, takes memory and clutters Office toolbars
::           : (It is also buggy. For much better PDF output from Office, use
::           : PDFFactory www.fineprint.com)
:: Version   : 1.0
:: Requires  : Adobe Acrobat 5.0
:: Note      : Edit path to executable's location
::-----------------------------------
:: #ZTSet _INSTALLMODE 1:Disable  2:Enable
IF [%_INSTALLMODE%] ==[1] goto Disable
IF [%_INSTALLMODE%] ==[2] goto Enable
goto exit

:Disable
md "C:\Program Files\Adobe\Acrobat 5.0\PDFMaker.OFF\"
md "C:\Program Files\Microsoft Office\Office10\XLStart.OFF\"
md "C:\Program Files\Microsoft Office\Office10\Startup.OFF\"
move "C:\Program Files\Adobe\Acrobat 5.0\PDFMaker\PDFMaker.ppa" "C:\Program Files\Adobe\Acrobat 5.0\PDFMaker.OFF\"
move "C:\Program Files\Adobe\Acrobat 5.0\PDFMaker\PDFMakerA.ppa" "C:\Program Files\Adobe\Acrobat 5.0\PDFMaker.OFF\"
move "C:\Program Files\Microsoft Office\Office10\XLStart\PDFMaker.xla" "C:\Program Files\Microsoft Office\Office10\XLStart.OFF\"
move "C:\Program Files\Microsoft Office\Office10\Startup\PDFMaker.dot" "C:\Program Files\Microsoft Office\Office10\Startup.OFF\"
goto exit

:Enable
move "C:\Program Files\Adobe\Acrobat 5.0\PDFMaker.OFF\PDFMaker.ppa" "C:\Program Files\Adobe\Acrobat 5.0\PDFMaker\"
move "C:\Program Files\Adobe\Acrobat 5.0\PDFMaker.OFF\PDFMakerA.ppa" "C:\Program Files\Adobe\Acrobat 5.0\PDFMaker\"
move "C:\Program Files\Microsoft Office\Office10\XLStart.OFF\PDFMaker.xla" "C:\Program Files\Microsoft Office\Office10\XLStart\"
move "C:\Program Files\Microsoft Office\Office10\Startup.OFF\PDFMaker.dot" "C:\Program Files\Microsoft Office\Office10\Startup\"
goto exit
|  |--VISUALISATION
|  |  |--rpVT
:: Purpose  : Start Rudy Penteado's assistant viewer and treater
::          :
::          : rpVT is the only viewer specifically designed to interact with
::          : Ztree. Shows images and file content in an independent
::          : window synchronized with current Ztree's highlighted file.
::          : Also performs various transform operations with tagged files
::          : Some users like to launch it by default with Ztree, but this
::          : script launch it from F9 only when needed.
::
:: Requires : rpVT (free), http://www.rpvt.com/
:: Note     : Edit path to executable's location (here in sudir below Ztree)
::-----------------------------------
cd #ZTHome\rpVT
start "" #ZTHome\rpVT\rpVT.exe /zd#ZTHome /ca1 /qz
|  |  |--CDisplay <file>
:: Purpose  : Start CDisplay Comic Book Reader
::          :
::          : Visualize and read JPEG/GIF directly from RAR/ZIP archive
::          : with many visualisation options. For scanned comic books.
::          :
:: Version  : 1.0
:: Requires : CDisplay (Free), http://www.geocities.com/davidayton/CDisplay
:: Note     : Edit path to executable's location.
:: Note2    : CDisplay doesn't necessarly need installation to run, making it
::          : portable on any system
::-----------------------------------

::Check if file has appropriate extension
IF /i [%5]==[zip] goto GoodExt
IF /i [%5]==[rar] goto GoodExt
IF /i [%5]==[tar] goto GoodExt
IF /i [%5]==[ace] goto GoodExt
IF /i [%5]==[gif] goto GoodExt
IF /i [%5]==[jpg] goto GoodExt
IF /i [%5]==[jpeg] goto GoodExt
IF /i [%5]==[png] goto GoodExt
IF /i [%5]==[cbr] goto GoodExt
IF /i [%5]==[cbz] goto GoodExt
IF /i [%5]==[png] goto GoodExt
:: If Win9X, the /i doesn't work. You must therefore type all lower/uppercase
:: variation !
exit
:GoodExt
start "" "#ZTHome\CDisplay\CDisplay.exe" %1
|  |  |--V3 <file|dir>
:: Purpose  : Start Jim Wilson's V3 viewer
::          :
::          : V3 is a fast and powerful console-based file viewer.
::          : Displays Unicode files adequately. Configurable syntax highlight
::          :
:: Requires : V3 viewer (free), http://wpattinson.com/JimWilson.zip
:: Note     : Edit path to executable's location (here in sudir below Ztree)
::-----------------------------------
:: If Ztree is in DW rather than FW, starts with its own file manager screen.
#ZTHome\V3\v3.EXE %1
|  |  |--VIEW <file|dir>
:: Purpose  : Start Malcolm Drury's VIEW viewer
::          :
::          : Console-based viewer really good at viewing old wordprocessor
::          : files (WP42,WP5,etc.) and HTML
::          :
:: Requires : VIEW Shareware), http://mdrury.hypermart.net/index.html
:: Note     : Edit path to executable's location (here in sudir below Ztree)
::-----------------------------------
:: If Ztree is in DW rather than FW, starts with its own file manager screen.
:: %7 is used instead of %1 because the utility doesn't handle LFN
#ZTHome\VIEW\VIEWN.EXE %7
|  |  |--WP51 <file|dir>
:: Purpose  : Start Wordperfect 5.1
::          :
::          : If you have a lot of old WP51 files, it is easier to view them
::          : with the application itself. Because WP is so small by today's
::          : standards and does not requires Windows installation, you just
::          : need to copy the executable files in a subdir. (I did it under Ztree dir)
::          :
:: Requires : Wordperfect 5.1 (DOS) minimal executable files
:: Note     : Edit path to executable's location
::-----------------------------------
:: %7 is used instead of %1 because the utility doesn't handle LFN
:: If Ztree is in DW rather than FW, starts with blank doc in current dir
#ZTHome\WP\WP.EXE %7
|  |  |--WP 6.0 <file|dir>
:: Purpose  : Start Wordperfect 6.0
::          :
::          : If you have a lot of old WP6 files, it is easier to view them
::          : with the application itself. Because WP is so small by today's
::          : standards and does not requires Windows installation, you just
::          : need to copy the executable files in a subdir. (I did it under Ztree dir)
::          :
:: Requires : Wordperfect 6.0 (DOS) minimal executable files
:: Note     : Edit path to executable's location
::-----------------------------------
:: %7 is used instead of %1 because the utility doesn't handle LFN
:: If Ztree is in DW rather than FW, starts with blank doc in current dir
#ZTHome\WP60\WP.EXE %7
|  |--MUSIC
|  |  |--m3u playlist <dir\*.mp3>
:: Purpose  : Create local m3u playlist in current directory with all *.MP3
:: Version  : 1.0
::          :
:: Note     : One problem comes from OEM to ANSI translation. Many MP3s have
::          : foreign characters in their title and for the m3u to be usable
::          : under Windows GUI, the dir output, initially produced as OEM, must
::          : be converted to ANSI. There are three ways offered to do this.
::          : Comment/Uncomment methods as required (one method must be uncommented
::          : at a time)
::-----------------------------------
:: 1st METHOD - Change code page - DEFAULT - NO UTILITY REQ.
::              found by Liviu
chcp 1252
dir *.mp3 /b > %6.m3u
:: Change codepage as required
:: http://www.microsoft.com/typography/unicode/cscp.htm
:: Latin 2 (1250)
:: Cyrillic (1251)
:: Latin 1 (1252)
:: Greek (1253)
:: Latin 5 (1254)
:: Hebrew (1255)
:: Arabic (1256)
:: Baltic (1257)
:: Viet Nam (1258)
:: Thai (874)
:: Japanese (932)
:: PRC GBK (XGB) (936)
:: Korean Extended Wansung (949)
:: Chinese (Taiwan, Hong Kong) (950)

:: 2nd METHOD - Use ReallySoft's OEM2ANSI utility
::              method found by me but optimized by Ben Kent
:: Requires : OEM2ANSI (free), http://www2.mikro.biologie.tu-muenchen.de/rs/soft/Soft.html
::            or patched version for English output by Charles
REM dir *.mp3 /b | oem2ansi -o >%6.m3u

:: 3rd METHOD - Use Binas-Holz's OEM2ANSI (Suggested by Ian Binnie)
:: Requires : OEM2ANSI (free),  http://www.sqldbu.com/eng/sections/tips/oem2ansi.html
REM dir *.mp3 /b > %6.m3u
REM oem2ansi %6.m3u em2ansi=french.oem

:: Once converted, start default player.
:: Comment line below if you do not want to play m3u automatically
start "" %6.m3u
|  |  |--m3u playlist <branch\*.mp3>
:: Purpose  : Create a portable m3u playlist in current directory and subdirs
::          : with all *.MP3
:: Note     : Same as above, but only one method exposed to avoid useless
::          : duplication of comments
::-----------------------------------
chcp 1252
dir *.mp3 /S /b > %6.m3u
:: Once converted, start default player.
:: Comment line below if you do not want to play m3u automatically
start "" %6.m3u
|  |  |--Temporary m3u playlist <tagfiles>
:: Purpose  : Create a temporary m3u playlist with tagged files and play it
:: Note     : %7 is used to avoid OEM/ANSI issues with filenames
::-----------------------------------
::Check if there are tagged files to operate with
REM #ZTIfTagged SET _ZTTAGGED=True
IF NOT [%%_ZTTAGGED%%]==[True] Goto Err_NoTag
REM #ZTTag #ZTTemp\tempo.m3u -f%7

:: The m3u file should be copied in general Temp dir of Windows to avoid unexpected
:: ending if Ztree quits while the music still playing. ZTree _ZTTAGGED directive
:: cannot interpret the Temp environment variable directly.
copy /Y #ZTTemp\tempo.m3u %Temp%
start "" %Temp%\tempo.m3u

exit
:Err_NoTag
  Echo Some files must be tagged and visible (File or Branch View)
  pause
  exit
|  |  |--Winamp Enqueue <file>
:: Purpose  : Put the current file in Winamp's queue
:: Requires : Winamp (free), http://www.winamp.com
::-----------------------------------
start "" "%ProgramFiles%\Winamp\winamp.exe" /ADD %1
|  |--DATA INTEGRITY
|  |  |--MD5/SFV - data integrity file
type %0 | more
pause
exit
:: Purpose  : Console scripts for MD5 / SFV
:: Version  : 1.0
:: Requires : FSUM (Free), http://www.slavasoft.com/fsum/
:: Optional : hkSFV (free) for GUI, http://www.big-o-software.com/

MD5 and SFV hash files are useful to check data integrity after critical
operations on files, such as burning, decompressing, emailing or copying over a
network. MD5 and SFV compute the checksum "signature" of any given set of files
in current directory or subdirectory. If one file is corrupted, in any way, even
by a single byte, it will be shown when verifying the hash file. However MD5/SFV
cannot fix or recover files.

SFV is a well known format but use a weaker algorithm than MD5. If the file is
sent or distributed to people ignorant of MD5 files, it's good practice to
generate both hash files, even if it doubles the time to create them.

All scripts are console-based and use freeware FSUM.

A good GUI freeware that handles well both MD5 and SFV is hkSFV. This program is
not updated anymore and it does not support command line, but it has a very
good interface.

Because hash files take some time to be created on large set of files, you
would be well-advised to run scripts as asynchronous batches (Alt-X)
|  |  |  |--Create MD5/SFV <branch>
:: Purpose  : Create MD5 and/or SFV with various option
::-----------------------------------

:: This directive below will be used only if the script is run asynchronous
REM #ZTStart "Creating MD5" /MIN

:://Option batch subroutine//
:: A unified menu with all the various option is offered. You can disable the menu
:: and set a single default option by changing only few lines
:: HOW TO DISABLE THE MENU
::      ENABLED                     DISABLED
::         REM SET _OPTION=x            SET _OPTION=1   (or your choice)
::         REM Goto Before_Option       Goto Before_Option
::         REM #ZTSET xxx               REM REM #ZTSET xxx
::         REM #ZTSET xxx               REM REM #ZTSET xxx

REM SET _OPTION = (number)
REM Goto Before_Option
REM #ZTSet _ANSWER1 FORMAT    1:MD5  2:SFV  3:Both              Esc:Exit (Enter=1)
REM #ZTSet _ANSWER2 FILENAME  1:DIRNAME.ext  2:hash.ext         Esc:Exit (Enter=1)

:: The number in NBCHOICE2 **MUST MATCH** the number of items available in
:: the seconde menu line !
SET _NBCHOICE2=2
IF [%_ANSWER1%]==[] SET _ANSWER1=1
IF [%_ANSWER2%]==[] SET _ANSWER2=1
::The arithmetic below works only on NT/2K/XP
SET /A _OPTION=(%_ANSWER1%*%_NBCHOICE2%)-%_NBCHOICE2%+%_ANSWER2%
:Before_Option
Goto Option_%_OPTION%

:: To avoid checksum files to check themselves while they are opened, they are
:: temporarily created in ZTTemp directory rather than in the target directory.
:: (otherwise an inelegant read-access error will be included in the hash file).

:Option_1
:: MD5 + dirname.md5
del *.md5 /Q
#ZTHome\fsum -d"%2:%3" -r -jnc *.* > "%0.md5"
copy /Y "%0.md5" %6.md5
exit

:Option_2
:: MD5 + hash.md5
del *.md5 /Q
#ZTHome\fsum -d"%2:%3" -r -jnc *.* > "%0.md5"
copy /Y "%0.md5" hash.md5
exit

:Option_3
:: SFV + dirname.SFV
del *.sfv /Q
#ZTHome\fsum -d"%2:%3" -r -js *.* > "%0.sfv"
copy /Y "%0.sfv" %6.sfv
exit

:Option_4
:: SFV + hash.SFV
del *.sfv /Q
#ZTHome\fsum -d"%2:%3" -r -js *.* > "%0.sfv"
copy /Y "%0.sfv" hash.sfv
exit

:Option_5
:: Both + dirname.ext
del *.md5 /Q
del *.sfv /Q
#ZTHome\fsum -d"%2:%3" -r -jnc *.* > "%0.md5"
copy /Y "%0.md5" %6.md5
#ZTHome\fsum -d"%2:%3" -r -js *.* > "%0.sfv"
copy /Y "%0.sfv" %6.sfv
exit

:Option_6
:: Both + hash.ext
del *.md5 /Q
del *.sfv /Q
#ZTHome\fsum -d"%2:%3" -r -jnc *.* > "%0.md5"
copy /Y "%0.md5" hash.md5
#ZTHome\fsum -d"%2:%3" -r -js *.* > "%0.sfv"
copy /Y "%0.sfv" hash.sfv
exit
|  |  |  |--Verify MD5/SFV <file>
:: Purpose  : Verify current file integrity with MD5 ou SFV hash
:: Note     : Output piped to temporary file by default because ouput is
::          : often bigger than console buffer
::-----------------------------------
IF /i [%5]==[sfv] goto GoodExt
IF /i [%5]==[md5] goto GoodExt
:: If Win9X, the /i doesn't work. You must therefore type all lower/uppercase
:: variation.
exit
:GoodExt

#ZTHome\fsum.exe -c "%1" > %0.chk
more %0.CHK
pause
exit
|  |  |--PAR2 - Data integrity and reconstruction of files
type %0 | more
pause
exit

:: Purpose  : Console scripts for PAR2
:: Version  : 1.0
:: Requires : PAR2cmdline Win32 (free)
::          : http://sourceforge.net/project/showfiles.php?group_id=30568&package_id=82331
:: Optional : QuickPar (free) for GUI, http://www.quickpar.org.uk/

PAR2 are almost magical files that not only check data integrity of any files,
but can also reconstruct any part of any corrupted file, or reconstruct from
from scratch any missing file. They are HIGHLY recommended for final archiving
or burning on CD. This ability comes to the price of few additionnal files in
current directory, and a small file size overhead.

PAR2 are based on a variant of the Reed-Solomon algorithm (redundacy check).
Very roughly said, it resolves equations with unknown terms

     Example:
     --------
     1 + 4 + 5 + 2 + ? = 20

In the example above, the missing term can be deducted mathematically. PAR2
work roughly the same way, but on files and with multiple unknown terms (each
"term" being a missing or corrupted segment (block) of a file)

The two biggest limitations of PAR2 are:
    - They don't recurse directories, so they are limited only to files in
      current directory
      (to do a branch, it is recommended to simply archive the branch first)
    - It takes time to create them

See http://parchive.sourceforge.net/ for more information.

All scripts are console-based and use freeware PAR2.
A good GUI utility that handles well PAR2 is also available from the same author.

Because par2 files take some time to be created on large set of files, you
would be well-advised to run scripts as asynchronous batches (Alt-X)
|  |  |  |--Create PAR2 <dir|tagfiles>
:: Purpose  : Create PAR2 files with various options
::-----------------------------------

:: This directive below will be used only if the script is run asynchronous
REM #ZTStart "Creating PAR2" /MIN


:://Option batch subroutine//
:: A unified menu with all the various option is offered. You can disable the menu
:: and set a single default option by changing only few lines
:: HOW TO DISABLE THE MENU
::      ENABLED                     DISABLED
::         REM SET _OPTION=x            SET _OPTION=1   (or your choice)
::         REM Goto Before_Option       Goto Before_Option
::         REM #ZTSET xxx               REM REM #ZTSET xxx
::         REM #ZTSET xxx               REM REM #ZTSET xxx

REM SET _OPTION = (number)
REM Goto Before_Option
REM #ZTSet _ANSWER1 FILES 1:all  2:rar only  3:zip only  4:current  5:tagged   Esc:Exit (Enter=1)
REM #ZTSet _ANSWER2 REDUNDACY 1:5% (default) 2:10% (CD) 3:1% (LAN)   Esc:Exit (Enter=1)

:: The number in NBCHOICE2 **MUST MATCH** the number of items available in
:: the seconde menu line !
SET _NBCHOICE2=3
IF [%_ANSWER1%]==[] SET _ANSWER1=1
IF [%_ANSWER2%]==[] SET _ANSWER2=1
::The arithmetic below works only on NT/2K/XP
SET /A _OPTION=(%_ANSWER1%*%_NBCHOICE2%)-%_NBCHOICE2%+%_ANSWER2%
:Before_Option
:: Delete any par2 files if exist
del *.par2 /Q
Goto Option_%_OPTION%

::PARAMETERS
:: 10% is good for CD burning, because one single but big scratch can affect
:: many of blocks or files
:: 1% is good for LAN or unstable system that can affect only few bytes in a file
::
:: The -s358400 set the size of block to 350Kb, an efficient size, especially
:: when Par2 are generated for rar files that are exactly 9800Kb (28x350Kb)
:: Of course, this can be changed.

:Option_1
#ZTHome\par2.exe create -s358400 -r5 %6 *.*
exit
:Option_2
#ZTHome\par2.exe create -s358400 -r10 %6 *.*
exit
:Option_3
#ZTHome\par2.exe create -s358400 -r1 %6 *.*
exit
:Option_4
#ZTHome\par2.exe create -s358400 -r5 %6 *.rar
exit
:Option_5
#ZTHome\par2.exe create -s358400 -r10 %6 *.rar
exit
:Option_6
#ZTHome\par2.exe create -s358400 -r1 %6 *.rar
exit
:Option_7
#ZTHome\par2.exe create -s358400 -r5 %6 *.zip
exit
:Option_8
#ZTHome\par2.exe create -s358400 -r10 %6 *.zip
exit
:Option_9
#ZTHome\par2.exe create -s358400 -r1 %6 *.zip
exit
:Option_10
#ZTHome\par2.exe create -s358400 -r5 %1
exit
:Option_11
#ZTHome\par2.exe create -s358400 -r10 %1
exit
:Option_12
#ZTHome\par2.exe create -s358400 -r1 %1
exit
:Option13
REM #ZTIfTagged SET _ZTTAGGED=True
IF NOT [%%_ZTTAGGED%%]==[True] Goto Err_NoTag
REM #ZTTag #ZTTemp\~tempo.bat -fSET _FILELIST=%_FILELIST% "%1"
call #ZTTemp\~tempo.bat
ZTHome\par2.exe create -s358400 -r5 %6 %_FILELIST%
exit
:Option14
REM #ZTIfTagged SET _ZTTAGGED=True
IF NOT [%%_ZTTAGGED%%]==[True] Goto Err_NoTag
REM #ZTTag #ZTTemp\~tempo.bat -fSET _FILELIST=%_FILELIST% "%1"
call #ZTTemp\~tempo.bat
#ZTHome\par2.exe create -s358400 -r10 %6 %_FILELIST%
exit
:Option15
REM #ZTIfTagged SET _ZTTAGGED=True
IF NOT [%%_ZTTAGGED%%]==[True] Goto Err_NoTag
REM #ZTTag #ZTTemp\~tempo.bat -fSET _FILELIST=%_FILELIST% "%1"
call #ZTTemp\~tempo.bat
#ZTHome\par2.exe create -s358400 -r1 %6 %_FILELIST%
exit

:Err_NoTag
Echo Some files must be tagged and visible (File or Branch View)
pause
exit
|  |  |  |--Verify PAR2 <file>
:: Purpose  : Verify current par2 set
:: Note     : Output can be longer than console buffer, but only summary is
::          : needed
::-----------------------------------
IF /i [%5]==[par2] goto Good_Ext
:: If Win9X, the /i doesn't work. You must therefore type all lower/uppercase
:: variation.
exit
:Good_Ext

#ZTHome\par2.exe v %1
pause
exit
|  |  |  |--Repair PAR2 <file>
:: Purpose  : Repair current par2 set
::-----------------------------------
IF /i [%5]==[par2] goto Good_Ext
:: If Win9X, the /i doesn't work. You must therefore type all lower/uppercase
:: variation.
exit
:Good_Ext

#ZTHome\par2.exe r %1
pause
exit
|  |  |--Recurse Directory Compare (DCOMP32) <dir1> <dir2>
:: Purpose  : Compare recursively content of two directories with CRC checking
::          : on all files. Result is shown in a minimal console-based display
:: Requires : DCOMP32, part of DATMAN99 package (Free)
::          : http://www.datman.com/
::          : To retrieve this utility:
::          : 1) Download the package from web site, 2) Start customized setup
::          : 3) select only "Utility programs for Win33" to be extract
::          : 4) move dcomp32.exe to your Ztree dir and delete everything else
:: Note     : Edit path to executable's location (here in sudir below Ztree)
::-----------------------------------
IF [%j1]==[] goto Err_NoSplit
#ZTHome\DCOMP32.EXE %2:%3 %j2:%j3
pause
exit

:Err_NoSplit
echo Ztree must be in split mode
pause
exit
|  |--ARCHIVES
type %0 | more
pause
exit

:: Purpose  : RAR, ZIP and WinRAR scripts
:: Version  : 1.0
:: Requires : WinRAR (Shareware), http://www.rarsoft.com
::          : RAR.EXE (Shareware), http://www.rarsoft.com
::          : ZIP/UNZIP.EXE (Free), http://www.info-zip.org/pub/infozip/
::-----------------------------------
Ztree archiver support is very good. However, not every options are
supported, and there some operations that are easier to perform from F9 than
from Alt-F5, like compressing a folder. Also, personal modifications to
ARCHIVER.BB2 must be tracked and copied whenever this file is updated.

There are hundreds of variant possible for archiving items. Here my variants.
Adapt to your need.

WinRAR is shareware but is a very good archiver. It supports many formats for
extracting. For archiving, it supports both standard ZIP and more performant
RAR format. In addition, the programs comes in two flavors, a GUI version and a
console version. Because console RAR.EXE do not support Zip files as WinRAR
does, console scripts are a bit more complex than WinRAR counterpart scripts to
handle the zip/unzip differences. (Unfortunately, the file extension detection
works only under NT/2K/XP)

Console scripts are not better but do not require to be priorly installed on
the OS (better for greater portability). GUI scripts have a nicer interface for
some operations. For Console ZIP, I've chosen the free Info-Zip. A more versatile
and powerful console tool such as PKzip can be used instead.

Managing and organizing so many variants of archiver scripts in a logical but
still lean hierachy is difficult, especially when dealing with GUI/Console.
I've solved this issue with a "default archiver mode (Gui or Console)" that can
be changed as needed.

WINRAR/RAR POPULAR PARAMETERS
==============================
RAR/WinRAR have many powerful switches. See doc for much more.

EXTRACTING
----------
x %1 %4\ = extract in new directory having same name as the archive
-o+ = Write over existing files
t = test archive

ARCHIVING
---------
a = archive
-r = recurse dir
-arar = with format rar (WinRAR only)
-azip = with format zip (WinRAR only)
-m5 = at maximum compression
-s = solid archive
-t = test archive after
-df = delete after
-msrar;zip = Store zip and rar, do not try to compress them (faster)
-tl = archive date is same as newest file in archive
-tk = keep original archive date (set in first pass)
%3.rar = with archive name having same name as directory
-x*.md5 -x*.SFV = exclude MD5 and SFV
-ibck = run WinRAR in background (WinRAR only)

UNZIP.EXE/ZIP.EXE COMMON PARAMETERS
====================================
EXTRACTING
-o = Overwrite existing files
-t = test archive

ARCHIVING
See Info-Zip doc for more
|  |  |--GUI <-> Console default archiver
:: #ZTSet _ANSWER1 DEFAULT ARCHIVER  1:Console 2:Gui 3:View current default
If [%_ANSWER1%]==[3] goto ViewDefault
:: Any answer other than 2 or 3 will set the default to Console
Set _DEFAULTARCHIVER=Console
If [%_ANSWER1%] == [2] Set _DEFAULTARCHIVER=GUI
Echo Set _DEFAULTARCHIVER=%_DEFAULTARCHIVER%>#ZTHome\_DefaultArchiver.cmd
goto exit

:ViewDefault
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [] Set _DEFAULTARCHIVER=Console
Echo The current default is %_DEFAULTARCHIVER%
pause
goto exit
|  |  |--EXTRACT
|  |  |  |--Extract <rar|zip> -> <subdir> overwrite
REM #ZTStart "Extracting %4 in subdir..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == ["GUI"] goto GUI
IF /i [%5]==[rar] goto Rar_Ext
IF /i [%5]==[zip] goto Zip_Ext
exit
:Rar_Ext
SET _FILENAME=%4
IF ["%_FILENAME:~-6%"]==[".part1"] SET _FILENAME="%_FILENAME:.part1=%"
#ZTHome\UNRAR.exe x -o+ %1 "%_FILENAME%"\
exit
:Zip_Ext
#ZTHome\unzip.exe -o %1 -d %4
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe x -o+ -ibck %1 %4\
|  |  |  |--Extract <rar|zip> -> <current dir> overwrite
REM #ZTStart "Extracting %4 in current dir..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
IF /i [%5]==[rar] goto Rar_Ext
IF /i [%5]==[zip] goto Zip_Ext
exit
:Rar_Ext
#ZTHome\UNRAR.exe x -o+ %1
exit
:Zip_Ext
#ZTHome\unzip.exe -o %1
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe x -o+ -ibck %1
|  |  |  |--Extract <*.zip> -> <current dir> overwrite
REM #ZTStart "Extracting *.ZIP in current dir..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
#ZTHome\unzip -o *.ZIP
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe x -o+ -ibck *.zip
|  |  |--CREATE
|  |  |  |--Archive <branch>, RAR, maxcomp, conserve
REM #ZTStart "Archiving %6 ..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
#ZTHome\RAR.exe  a -r -m5 -s -t -msrar;zip -tl %3.rar *.*
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe a -r -afrar -m5 -s -t -msrar;zip -tl -ibck %3.rar *.*
|  |  |  |--Archive <branch>, ZIP, maxcomp, conserve
REM #ZTStart "Archiving %6 ..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
#ZTHome\zip.exe -r9ST %3 *.*
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe a -r -afzip -m5 -s -t -msrar;zip -tl -ibck %3.zip *.*
|  |  |  |--Archive <tagfiles>, RAR, maxcomp, conserve
::Check if there are tagged files to operate with
REM #ZTIfTagged SET _ZTTAGGED=True
IF NOT [%%_ZTTAGGED%%]==[True] Goto Err_NoTag

:: Works only for small number of files (limited by environment space)
REM #ZTTag #ZTTemp\~tempo.bat -fSET _FILELIST=%_FILELIST% "%1"
call #ZTTemp\~tempo.bat
:: Tag list is in _FILELIST environment variable

REM #ZTStart "Archiving tagged files ..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
#ZThome\RAR.EXE a -r -m5 -s -t -msrar;zip -tl %6.rar %_FILELIST%
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe  a -r -m5 -s -t -msrar;zip -tl -ibck %6.rar %_FILELIST%
exit

:Err_NoTag
Echo Some files must be tagged and visible (File or Branch View)
pause
exit
|  |  |  |--Archive <branch>, RAR, maxcomp, DELETE
REM #ZTStart "Archiving %6 ..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
#ZTHome\RAR.exe  a -r -m5 -s -t -msrar;zip -tl -df %3.rar *.*
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe a -r -afrar -m5 -s -t -df -msrar;zip -tl -ibck %3.rar *.*
|  |  |  |--Archive <branch>, rar, maxcomp, DELETE, STORE JPEG
::           : JPEG are already compressed files. Recompressing them with RAR
::           : result in marginal gain, but much slower speed
::           : Use this script when speed is more important than compression and
::           : the number of jpeg is important.
::-----------------------------------
REM #ZTStart "Archiving %6 ..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
#ZTHome\RAR.exe  a -r -m5 -s -t -msrar;zip;jpeg;jpg -tl -df %3.rar *.*
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe a -r -afrar -m5 -s -t -df -msrar;zip;jpeg;jpg -tl -ibck %3.rar *.*
|  |  |  |--Archive <branch>, rar, maxcomp, DELETE, DATE=LAST FILE, MD5/SFV SECOND PASS
:: Purpose   : Set the date of the archive to be the same as newest file
::           : EXCLUDING any MD5 or SFV. These files are often generated much later
::           : than the files they are checking.
::           : We don't want the date of these files to set the date of the archive.
::           : They are therefore added in a second pass.
::-----------------------------------
REM #ZTStart "Archiving %6 ..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
#ZTHome\RAR.exe a -r -m5 -s -t -df -msrar;zip -tl -x*.md5 -x*.SFV %3.rar *.*
#ZTHome\RAR.exe a -r -m5 -s -t -df -tk %3.rar *.*
exit
:Gui
start /WAIT "" c:\progra~1\WinRAR\WinRAR.exe a -r -afrar -m5 -s -t -df -msrar;zip -tl -x*.md5 -x*.SFV -ibck %3.rar *.*
start "" c:\progra~1\WinRAR\WinRAR.exe a -r -afrar -m5 -s -t -df -tk -ibck %3.rar *.*
|  |  |--VERIFY
|  |  |  |--Verify <file>
REM #ZTStart "Verifying %4..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
IF /i [%5]==[rar] goto Rar_Ext
IF /i [%5]==[zip] goto Zip_Ext
exit
:Rar_Ext
#ZTHome\UNRAR.exe t %1 > "%0.TMP"
more "%0.TMP"
pause
exit
:Zip_Ext
#ZTHome\unzip.exe -t %1 > "%0.TMP"
more "%0.TMP"
pause
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe t -ibck %1
|  |  |  |--Verify <dir\*.rar>
REM #ZTStart "Verifying *.RAR in %6..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
#ZTHome\UNRAR.exe t *.rar > "%0.TMP"
more "%0.TMP"
pause
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe t -ibck *.rar
|  |  |  |--Verify <dir\*.zip>
REM #ZTStart "Verifying *.ZIP in %6..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
#ZTHome\unzip.exe -t *.zip > "%0.TMP"
more "%0.TMP"
pause
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe t -ibck *.zip
|  |  |  |--Verify <branch\*.rar>
REM #ZTStart "Verifying *.RAR in %6 subdir..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
#ZTHome\UNRAR.exe t -r *.rar > "%0.TMP"
more "%0.TMP"
pause
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe t -r -ibck *.rar
|  |  |  |--Verify <dir\*.zip>
REM #ZTStart "Verifying *.ZIP in %6 subdir..."
If Exist #ZTHome\_DefaultArchiver.cmd Call #ZTHome\_DefaultArchiver.cmd
If [%_DEFAULTARCHIVER%] == [GUI] goto GUI
echo Not available with unzip console. Use GUI.
pause
exit
:Gui
start "" c:\progra~1\WinRAR\WinRAR.exe t -r -ibck *.zip
|  |--MY NETWORK
type %0 | more
pause
exit

:: Version  : 1.0

I use these scripts to map / unmap network drives on my home LAN. They are
useless to any other user than me, but they can easily be adapted to other
contexts.

Remote connection scripts need a RDP file (created by WinXP Remote Connection
wizard) to be located in the Ztree directory.
|  |  |--SERVMAISON
|  |  |  |--Remote Desktop
Start "" "#ZTHome\Servmaison.RDP"
|  |  |  |--Connect main drives (R,S)
net use R: \\192.168.0.1\dataservmaison /persistent:No
net use S: \\192.168.0.1\libservmaison /persistent:No
|  |  |  |--Disconnect main drives (R,S)
net use R: /delete
net use S: /delete
|  |  |  |--Connect ALL drives (R,S,V,X,O)
net use R: \\192.168.0.1\dataservmaison /persistent:No
net use S: \\192.168.0.1\libservmaison /persistent:No
net use V: \\192.168.0.1\cdyservmaison /persistent:No
net use X: \\192.168.0.1\dvdzservmaison /persistent:No
net use O: \\192.168.0.1\rootservmaison /persistent:No
|  |  |  |--Disconnect ALL drives (R,S,V,X,O)
net use R: /delete
net use S: /delete
net use V: /delete
net use X: /delete
net use O: /delete
|  |  |--CPE
|  |  |  |--Remote Desktop
Start "" "#ZTHome\CPE.RDP"
|  |  |--LAVRENDI
|  |  |  |--Remote Desktop
Start "" "#ZTHome\Lavrendi.RDP"
|  |  |--LOGIN NOVELL
:: Purpose   : Call the Login screen to connect to a Novell Network
cd %HOMEDRIVE%%HOMEPATH%
start "Login Novell" "%SystemRoot%\System32\loginw32.exe"
|  |  |--Disconnect current network drive
%SystemDrive%
net use %2: /d
|  |  |--Subsitute drive to current directory
:: Modified : by Laurent. Fixed the missing : in Subst %Drive%:...
:: Version  : 1.01
REM #ZTSet Drive Drive letter:
If [%Drive%]==[] goto End
if exist %Drive%:\ goto Error
  Subst %Drive%: %2:%3
  goto End
:Error
  Echo Drive already exists
  Pause
:End
|  |  |--Disconnect current Subsitute Drive
%SystemDrive%
Subst /d %2:
|  |--NET Management and Info
exit

All scripts in this section are taken from Ben Kent menu.
|  |  |--IPConfig
ipconfig /all|more
pause
|  |  |--Name Server Lookup (NSLookup)
:: #ZTSet Host  Destination Host:
If [%Host%]==[] goto end
nslookup %Host%
pause
:end
|  |  |--NetStat connections
netstat -a|more
pause
|  |  |--NetStat Statistics
netstat -e -s|more
pause
|  |  |--NetBIOS over TCP/IP (NTBStat)
|  |  |--NBTStat Cache
nbtstat -c|more
pause
|  |  |--NBTStat Names
nbtstat -n|more
pause
|  |  |--NBTStat ReleaseRefresh
nbtstat -RR
pause
|  |  |--NBTStat Resolution Statistics
nbtstat -r|more
pause
|  |  |--NBTStat Sessions
nbtstat -s|more
pause
|  |  |--Ping
:: #ZTSet Host  Destination Host:
If [%Host%]==[] goto end
ping %Host%
pause
:end
|  |  |--Trace Route (TraceRt)
:: #ZTSet Host  Destination Host:
If [%Host%]==[] goto end
tracert %Host%
pause
:end
|  |  |--Show Available Domains
net view /d|more
pause
|  |  |--Show Machines in domain
:: #ZTSet Domain   "Domain (null for current):"
if [%Domain%]==[] goto Current
  net view /d:%Domain% |more
  goto end
:Current
  net view|more
:End
pause
|  |  |--Show Shares on machine
:: #ZTSet MachineName   "MachineName (null for current):"
if [%MachineName%]==[] goto Current
  net view \\%MachineName% |more
  goto end
:Current
  net share
:End
pause
|  |  |--Show Mapped Drives
net use
pause
|  |  |--Show Substituted Drives
subst
pause
|  |--VIDEO
exit

These scripts modify the screen resolution.

Free utility NirComLine is required. This very small utility (14Kb) is
full pack of features that can be used for other scripts so it's a
nice addition to Ztree home directory.

http://freehost14.websamba.com/nirsoft/utils/nircomline.html
|  |  |--1024x768
#ZTHome\Nircomline setdisplay 1024 768 32
|  |  |--800x600
#ZTHome\Nircomline setdisplay 800 600 32
|  |  |--640x480
#ZTHome\Nircomline setdisplay 600 480 32
|  |--WINDOWS TWEAKS AND MAINTENANCE
|  |  |--Trash the Trashcan <currdrive>
:: Purpose  : Trash the trashcan on current drive. This is radical cleaning :-)
:: Notes    : This affect all users on the target drive!
echo This script will PRUNE the trashcan on the current drive for ALL USERS.
echo.
echo Press Ctrl-Break to interrupt this command or
pause
cd %2:
RD "RECYCLER" /S /Q
|  |  |--Register/Unregister PKZIPC on this computer
:: Purpose  : PKZIPC.EXE 6.0 console shareware annoyingly requires a
::          : Registration Registry key in order to run.
::          : This script register and unregister it on any host computer
:: Version  : 1.0
:: Requires : PKZIP 6.0 (shareware), http://www.pkware.com
::-----------------------------------
:: #ZTSET _ANSWER1 PZIPC 6.0  1:Register  2:Unregister  3:Extract and save serial
If [%_ANSWER1%]==[1] Goto Register
If [%_ANSWER1%]==[2] Goto UnRegister
If [%_ANSWER1%]==[3] Goto FindSerial
goto exit

:Register
:: Two methods for registration are proposed: from a previously created registration
:: file in ZTHome or directly from an edited version of script).
:: Choose whatever suite you best.
:: If you choose second method, just uncomment the line below
REM Goto RegisterSecondMethod

If not Exist #ZTHome\_PKZIPCSerial.REG goto NoSerialFound
Start regedit.exe /s #ZTHome\_PKZIPCSerial.REG
echo When leaving a host computer, don't leave your registration behind!
pause
exit
:NoSerialFound
echo The serial registration file can't be found in #ZTHome
echo Registration of PKZIPC couldn't be completed.
echo Please extract and save serial first on a computer where PKZIPC is installed
pause
exit

:RegisterSecondMethod
echo REGEDIT4 >> #ZTtemp\PKWAREREG.REG
echo [HKEY_LOCAL_MACHINE\SOFTWARE\PKWARE\SN\0x660] >> #ZTtemp\PKWAREREG.REG
:: Note: YOU MUST insert *YOUR REAL* serial below !!!
echo "Serial"="1234567890" >> #ZTTemp\PKWAREREG.REG
start /WAIT "Register PKZIPC to this computer" regedit.exe /s #ZTTemp\PKWAREREG.REG
del #ZTTemp\PKWAREREG.REG
echo When leaving a host computer, don't leave your registration behind!
pause
exit

:Unregister
echo REGEDIT4 > #ZTtemp\PKWAREUNREG.REG
echo [-HKEY_LOCAL_MACHINE\SOFTWARE\PKWARE] >> #ZTtemp\PKWAREUNREG.REG
start /WAIT "Register PKZIPC to this computer" regedit.exe /s #ZTTemp\PKWAREUNREG.REG
del #ZTTemp\PKWAREUNREG.REG
exit

:FindSerial
regedit /e #ZTHome\_PKZIPCSerial.REG "HKEY_LOCAL_MACHINE\SOFTWARE\PKWARE\SN\0x660"
exit
|  |  |--CLEAN history and temp files for IE6, Windows, others programs (SAFE MODE ONLY)
:: Purpose  : Delete most common history and temporary usage
::            of Windows XP FR
:: Version  : 1.0
:: Note1    :
:: Note2    :
::            Windows
:: Note3    :
:: Note4    :

:: Windows
echo * * * THIS IS A VERY POWERFUL SCRIPT. USE WITH CAUTION * * *
echo.
echo This script should be run ONLY in SAFE CONSOLE-MODE because it deletes folders
echo the would be otherwise protected by Windows.
echo.
echo To boot in safe console-mode, you need to reboot Windows and press F5 BEFORE
echo the Windows logo shows up and make the appropriate selection in the startup menu.
echo Then, from the prompt, type ZTW to launch Ztree (assuming ZTW is in your path.
echo.
echo This script delete history usage from Windows and selected programs.
echo.
echo   - IE cookies, history and cache (current user only)
echo   - Userprofile temp and recent folders (current user only)
echo   - Windows Temp, Prefetch folders (all users)
echo   - Windows Recycler folder (System drive only)
echo   - Opera 7.5 cache
echo   - Windows Media Player, Winamp, Bsplayer, Yankee Clipboard III histories
echo.
echo All deleted folders, files and registry keys are usually recreated empty
echo when Windows and programs run again.
echo.
echo This script was written for French version of Windows XP. You need to modify some
echo paths to adapt to your local version of Windows.
echo.
echo Press Ctrl-Break to interrupt this command or
pause
:: When the script tries to delete something non-existent or not installed,
:: nothing wrong happen, so you can safely leave all parts of the script uncommented
:: even if you do not have the program
%SYSTEMDRIVE%
RD "%USERPROFILE%\Cookies\" /S /Q
:: on English system, that line below would be "History" I guess
RD "%USERPROFILE%\Local Settings\Historique\" /S /Q
RD "%USERPROFILE%\Local Settings\Temp\" /S /Q
RD "%USERPROFILE%\Local Settings\Temporary Internet Files\" /S /Q
RD "%USERPROFILE%\Recent\" /S /Q
RD "C:\WINDOWS\Temp\" /S /Q
RD "C:\WINDOWS\Prefetch\" /S /Q
RD "C:\RECYCLER" /S /Q
:: Opera 7.5
:: This is MY opera cache location. Adapt to your system
RD "C:\Program Files\Opera75\profile\Cache4\" /S /Q
:: Windows Media Player
echo REGEDIT4 > #ZTtemp\CLEANMEDIAPLAYERHISTORY.REG
echo [-HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Player\Recent_FILELIST] >> #ZTtemp\CLEANMEDIAPLAYERHISTORY.REG
echo [HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Player\Recent_FILELIST] >> #ZTtemp\CLEANMEDIAPLAYERHISTORY.REG
start /WAIT "Clean Windows Media Player History" regedit.exe /s #ZTTemp\CLEANMEDIAPLAYERHISTORY.REG
:: Winamp
del /Q "C:\Program Files\Winamp\winamp.m3u"
:: Yankee Clipboard III
del /Q "C:\Program Files\YCIII\History.YC\"
:: BSPlayer
del /Q "C:\Program Files\Webteh\BSPlayer\bsplist.bsl"
|  |  |--Generic submenus in Start Menu
:: Purpose  : Customize the Start menu with general categories
:: Version  : 1.0
:: Note     : This is a sample. Customize to your needs.
::-----------------------------------

SET _SECONDPASSDONE=0
%SYSTEMDRIVE%


:: Enable (uncomment) only the line that works on your local version of Windows
::cd "%ALLUSERSPROFILE%\Start menu\Programs\"
cd "%ALLUSERSPROFILE%\Menu D‚marrer\Programmes\"
goto CreateMyDir
:SecondPass
IF [%%_SECONDPASSDONE%%]==[1] Goto exit
:: Enable (uncomment) only the line that works on your local version of Windows
cd "%USERPROFILE%\Menu D‚marrer\Programmes\"
::cd "%USERPROFILE%\Start menu\Programs\"
SET _SECONDPASSDONE=1

:CreateMyDir
md "ACCESSOIRES\WINDOWS XP"
md "ACCESSOIRES\EDITEURS TEXTES"
md "ACCESSOIRES\CALCULATRICES"
md "INTERNET\NEWS"
md "INTERNET\WEB"
md "INTERNET\CLAVARDAGE"
md "INTERNET\COURRIEL"
md "INTERNET\FTP"
md "INTERNET\RESEAU"
md "DEVELOPPEMENT\HTML"
md "DEVELOPPEMENT\INSTALLATION"
md "DEVELOPPEMENT\SCRIPTS"
md "MULTIMEDIA\LECTEURS"
md "MULTIMEDIA\CODEC"
md "MULTIMEDIA\UTILS AUDIO"
md "MULTIMEDIA\UTILS VIDEO"
md "GENERAL"
md "GRAPHISME"
md "PALM"
md "REFERENCE"
md "JEUX"
md "OFFICE XP"
md "UTILITAIRES\CDROM"
md "UTILITAIRES\AMELIORATIONS"
md "UTILITAIRES\COMPRESSION & CRC"
md "UTILITAIRES\ASTUCES"
md "UTILITAIRES\PROTECTION ET ENCRYPTAGE"
md "UTILITAIRES\MATERIEL"
Goto SecondPass
|  |  |--Convert <file> OEM --> ANSI
:: Purpose  : Convert a text file from OEM (DOS) to ANSI
::          : Especially useful to use output with foreign characters
::          : from Windows console mode (dir, type, etc.)
:: Submitter: Ben Kent
:: Requires : OEM2ANSI utility, http://www2.mikro.biologie.tu-muenchen.de/rs/soft/Soft.html
::-----------------------------------
type %1 | oem2ansi.exe -o > #ZTTemp\~conv.tmp
Set CopyCmd=/y
REM The /b is to make sure that copy will continue after a Ctrl-Z (EOF) marker
copy /b #ZTTemp\~conv.tmp %1
del #ZTTemp\~conv.tmp
|  |--ADMIN AND SECURITY
:: Name     : Win2K/XP Admin Tools
:: Purpose  : Display the installed admin tools, the sub items run seleted tools
:: Submitter: Ben Kent
:: Modified : 18 Mar 2004
:: Requires : Windows 2000 or Windows XP
::-----------------------------------
|  |  |--Registry editor Local
Start Regedit.exe
|  |  |--Computer Management
Start %SystemRoot%\system32\compmgmt.msc
|  |  |--Group policy editor
start %SystemRoot%\system32\gpedit.msc
|  |  |  |--Refresh machine
secedit /refreshpolicy machine_policy /enforce
pause
|  |  |  |--Refresh user
secedit /refreshpolicy user_policy /enforce
pause
|  |  |--Local Security Policy
Start %SystemRoot%\system32\secpol.msc
|  |  |--Performance
Start %SystemRoot%\system32\perfmon.msc
|  |  |--Services
Start %SystemRoot%\system32\services.msc
|  |--INFO
|  |  |--DirectX Diagnostics
:: Purpose  : Launch DirectX diagnostic routine
::-----------------------------------
Start "" %SystemRoot%\system32\dxdiag.exe
|  |  |--Basic System Information (Jim Wilson's utility)
:: Purpose  : Launch System Info utility
::          : Jim Wilson's SystemInfo utility is free, console-based and
::          : only 19Kb, but returns useful basic info on computer and network
:: Requires : SystemInfo utility (free), http://wpattinson.com/JimWilson.zip
::-----------------------------------
#ZTHome\SystemInfo.exe
pause
|  |  |--Show Environment State
:: Name     : Show Environment State
:: Purpose  : Displays system environment variables, and active command processor options
:: Submitter: Ben Kent
:: Modified : 19 Mar 2004
:: Requires : Nothing, but works better under NT+
::-----------------------------------
Echo CD            %CD%
Echo Date          %DATE%
Echo Time          %TIME%
Echo Random        %RANDOM%
Echo ErrorLevel    %ERRORLEVEL%
Echo CmdExtVersion %CMDEXTVERSION%
Echo CmdCmdLine    %CMDCMDLINE%
Echo ComSpec       %ComSpec%

Set CmdExtensions=Enabled
If [%CMDEXTVERSION%]==[] Set CmdExtensions=Disabled
Echo Command Extensions are %CmdExtensions%

Set LateExpansion=Disabled
Set _D=!windir!
If [%_D%]==[%SystemRoot%] Set LateExpansion=Enabled
Echo Late Expansion is %LateExpansion%
Echo.
REM Echo ALLUSERSPROFILE    %ALLUSERSPROFILE%
Echo APPDATA            %APPDATA%
Echo CLIENTNAME         %CLIENTNAME%
REM Echo CommonProgramFiles %CommonProgramFiles%
Echo COMPUTERNAME       %COMPUTERNAME%
REM Echo ComSpec            %ComSpec%
Echo HOMEDRIVE          %HOMEDRIVE%
Echo HOMEPATH           %HOMEPATH%
Echo LOGONSERVER        %LOGONSERVER%
REM Echo NUMBER_OF_PROCESSORS %NUMBER_OF_PROCESSORS%
REM Echo OS                 %OS%
Echo Path               %Path%
REM Echo PATHEXT            %PATHEXT%
REM Echo PROCESSOR_ARCHITECTURE %PROCESSOR_ARCHITECTURE%
REM Echo PROCESSOR_IDENTIFIER %PROCESSOR_IDENTIFIER%
REM Echo PROCESSOR_LEVEL    %PROCESSOR_LEVEL%
REM Echo PROCESSOR_REVISION %PROCESSOR_REVISION%
REM Echo ProgramFiles       %ProgramFiles%
REM Echo PROMPT             %PROMPT%
Echo SESSIONNAME        %SESSIONNAME%
REM Echo SystemDrive        %SystemDrive%
Echo SystemRoot         %SystemRoot%
Echo TEMP               %TEMP%
Echo USERDNSDOMAIN      %USERDNSDOMAIN%
Echo USERDOMAIN         %USERDOMAIN%
Echo USERNAME           %USERNAME%
Echo USERPROFILE        %USERPROFILE%
REM Echo windir             %windir%
Pause
|  |  |--Show Environment Variables
:: Name     : Show Environment Variables
:: Purpose  : Display all the active environment variables
:: Submitter: Ben Kent
:: Modified : 18 Mar 2004
:: Requires : Nothing
::-----------------------------------
set | more
pause
|  |  |--Show running services
net start|more
pause
|  |  |--Complete System Information (GUI)
start winmsd
|  |--MULTIPLES OPERATION
|  |  |--Final archiving <branch> (MD5/SFV/RAR), DELETE
:: Purpose   : Combined script MD5/SFV/RAR to create a final archive of data
::           : files or system images before they are burned on CD.
:: Notes     : See MD5, SFV and RAR scripts for more explanation.
:: Requires  : FSUM (free), http://www.slavasoft.com/fsum/
::           : RAR (shareware), http://www.rarsoft.com
::-----------------------------------

:: YOU WOULD BE WELL-ADVISED TO RUN THIS SCRIPT AS ASYNCHRONOUS BATCH (ALT-X)
:: BECAUSE IT CAN TAKES SOME TIME TO RUN (from few seconds to hours). More than
:: one asynchronous occurences can run simultaneously

:: To avoid unexpected results if Ztree session closes before all occurrences of
:: the scripts are still running, the batch file will copy itself in Windows Temp
:: directory
If ["%%~s0"]==["%%TEMP%%\%~ns0.BAT"] Goto MainSection
copy #ZTTemp\%~n0.BAT %TEMP% /Y
Start "Final archiving" "%TEMP%\%~n0.BAT"
exit

:MainSection
:: For peace of mind, two common data integrity checksum files created
del *.md5 /Q
del *.sfv /Q
#ZTHome\fsum -d"%2:%3" -r -jnc *.* > "%0.md5"
copy /Y "%0.md5" hash.md5
#ZTHome\fsum -d"%2:%3" -r -js *.* > "%0.sfv"
copy /Y "%0.sfv" hash.sfv
:: Use double-pass compression to set archive date to be same as newest file
:: except md5 and sfv
#ZTHome\RAR.exe a -r -m5 -s -t -df -msrar;zip -tl -x*.md5 -x*.SFV %3.rar *.*
#ZTHome\RAR.exe a -r -m5 -s -t -df -tk %3.rar *.*
:: Delete folder if empty
move %3.rar ..
cd ..
rmdir %3
del "%0.sfv"
del "%0.md5"
del %0
|  |  |--Compressing <branch> Usenet-Style (NFO/MD5/SFV/SplitRAR), DELETE
:: Purpose   : Combined script NFO/PAR2/MD5/SFV/RAR to create archive of data
::           : with Usenet conventions
::           : Might be also used for final archiving
:: Notes     : See MD5, SFV and RAR scripts for more explanation.
:: Requires  : FSUM (free), http://www.slavasoft.com/fsum/
::           : RAR (shareware), http://www.rarsoft.com
::           : PAR2 (free), http://sourceforge.net/project/showfiles.php?group_id=30568&package_id=82331
::-----------------------------------

:: YOU WOULD BE WELL-ADVISED TO RUN THIS SCRIPT AS ASYNCHRONOUS BATCH (ALT-X)
:: BECAUSE IT CAN TAKES SOME TIME TO RUN (from few seconds to hours). More than
:: one asynchronous occurences can run simultaneously

:: (THIS IS THE LONGEST WAY OF ARCHIVING IMAGINABLE)

:: Check if exists a NFO file with same name of current directory and make a copy
IF EXIST %6.NFO GOTO No_ErrNFO
  Echo For documentation purpose, this script requires an iNFOrmation file
  echo with name:  %6.NFO
  echo to be located in the current directory. This file is a simple text
  echo file that describes the content of what will be archived.
  echo.
  echo A blank one has been created for you.
  pause
  echo This archive contains: > "%6.NFO"
  start "" notepad.exe "%6.NFO"
  exit

:No_ErrNFO
:: To avoid unexpected results if Ztree session closes before all occurrences of
:: the scripts are still running, the batch file will copy itself in Windows Temp
:: directory
If ["%%~s0"]==["%%TEMP%%\%~ns0.BAT"] Goto MainSection
copy #ZTTemp\%~n0.BAT %TEMP% /Y
Start "Compressing Usenet-Style" "%TEMP%\%~n0.BAT"
exit

:MainSection
copy %6.NFO "%0.NFO"
:: Two common data integrity checksum files created
del *.md5 /Q
del *.sfv /Q
#ZTHome\fsum -d"%2:%3" -r -jnc *.* > "%0.md5"
copy /Y "%0.md5" hash.md5
#ZTHome\fsum -d"%2:%3" -r -js *.* > "%0.sfv"
copy /Y "%0.sfv" hash.sfv
:: Archives with maximum compression (slowest speed)
:: The RAR archive is splitted in segments of 9800k
:: This is desirable for burning on CD, essentially to avoid situation where all
:: data are archived in one big RAR file and that file is unreadable/copiable
:: because of one single CD scratch. By splitting the archive into many smaller files,
:: chances are greater to recover a good number of them if problems
:: occur. Existing ZIP and RAR files are not compressed. Files are
:: tested and deleted after they have been compressed. In addition, the RAR set
:: incorporates in header the content of the NFO file.
#ZTHome\RAR.exe a -r -m5 -s -t -df -msrar;zip -v9800k -tl -z%6.NFO %3.rar *.*
:: PAR2 use blocks of 350Kb (358,400 bytes) and RAR volumes
:: size are exactly 28 x 350Kb = 9800Kb. This is to improve PAR2
:: performance.
#ZTHome\par2.exe create -s358400 -r5 ..\%6 ..\*.rar
:: Copy back the NFO once the par2 created
copy "%0.NFO" ..\%6.NFO
cd ..
rmdir %3
del "%0.sfv"
del "%0.md5"
del "%0.nfo"
del %0


Updated: 2004-06-10 14:45
Copyright 2004 vujnovic@free.fr. All rights reserved.