home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / d / d020_1_4 / 2.ddi / DBGTOOLS / SWITCH.BAT < prev    next >
Encoding:
DOS Batch File  |  1990-06-01  |  4.7 KB  |  175 lines

  1. @echo off
  2.  
  3. set Is386=<<Is386>>
  4. set WinPath=<<WindowsSystemDir>>
  5. set DbgPath=<<SDKDebugDir>>
  6. set NoDPath=<<SDKNoDebugDir>>
  7.  
  8. if (%NoDPath%)==(<<SDKNoDebugDir>>) goto ErrorChecking
  9.     rem -----------------------------------
  10.     rem  Display Out of Env. Space Message 
  11.     rem -----------------------------------
  12.  
  13.     echo:
  14.     echo: Error: Out of Environment Space !!
  15.     echo:
  16.     echo:        Increase the size of your environment using the 
  17.     echo:        '/e' switch on COMMAND.COM.
  18.     echo:
  19.     goto Done
  20.  
  21. :ErrorChecking
  22.     if (%WinPath%)==() goto NoWinPath
  23.     if (%1)==(N) goto NoDebug
  24.     if (%1)==(D) goto Debug
  25.     goto Usage
  26.  
  27. :NoWinPath
  28.     rem -----------------------------
  29.     rem  Display Set WinPath Message
  30.     rem -----------------------------
  31.  
  32.     echo:
  33.     echo: Error: Windows System Path not set !!
  34.     echo:
  35.     echo:    Set the "WinPath" environment variable in
  36.     echo:    %0.BAT to your Windows System Directory.
  37.     echo:    Also make sure you have copied NoDebug EXEs
  38.     echo:    to your NoDebug directory (see readme.txt)
  39.     echo:
  40.     goto Done
  41.  
  42. :Usage
  43.     rem --------------------------
  44.     rem  Display SWITCH.BAT Usage
  45.     rem --------------------------
  46.  
  47.     echo:
  48.     echo: Usage:
  49.     echo:        %0 {N or D}
  50.     echo:
  51.     echo: where  N = switch to nodebug version of windows
  52.     echo:        D = switch to debug version of windows
  53.     echo:
  54.     echo: NOTE: %0 is normally called by N2D & D2N -- please use one of these
  55.     echo:
  56.     goto Done
  57.  
  58. :Debug
  59.     rem ------------------------
  60.     rem   Debug Initialization
  61.     rem ------------------------
  62.  
  63.     echo Switching to Debug .EXEs and .SYMs
  64.     set NoDPath=
  65.     set ToDir=%DbgPath%
  66.     set DbgPath=
  67.     set From=N
  68.     goto SwitchFiles
  69.  
  70. :NoDebug
  71.     rem ------------------------
  72.     rem  NoDebug Initialization
  73.     rem ------------------------
  74.  
  75.     echo Switching to NoDebug .EXEs and .SYMs
  76.     set DbgPath=
  77.     set ToDir=%NoDPath%
  78.     set NoDPath=
  79.     set From=D
  80.  
  81. :SwitchFiles
  82.     rem ------------------------------------
  83.     rem  Group Loop Variable Initialization
  84.     rem ------------------------------------
  85.  
  86.     set Grp=GDI
  87.  
  88. :GroupLoop
  89.         rem -----------------------------------
  90.         rem  Type Loop Variable Initialization
  91.         rem -----------------------------------
  92.  
  93.         set Type=EXE
  94.  
  95.     :TypeLoop
  96.         echo     %Grp%.%Type%:
  97.  
  98.             if exist %WinPath%\%Grp%%1.%Type%  goto ToFileExists
  99.  
  100.             rem -----------------------------------
  101.             rem  Copy file directly to destination 
  102.             rem -----------------------------------
  103.  
  104.             echo         %ToDir%\%Grp%.%Type%  to  %WinPath%\%Grp%.%Type%
  105.             copy %ToDir%\%Grp%.%Type% %WinPath%
  106.             goto DoneTypeLoop
  107.  
  108.         :ToFileExists
  109.             if not exist %WinPath%\%Grp%.%Type%        goto MoveToFile
  110.             if not exist %WinPath%\%Grp%%From%.%Type%  goto MoveDefault
  111.  
  112.             rem ----------------------------
  113.             rem  Delete file to be replaced
  114.             rem ----------------------------
  115.  
  116.             del %WinPath%\%Grp%.%Type%
  117.             goto MoveToFile
  118.  
  119.         :MoveDefault
  120.             rem ----------------------------
  121.             rem  Retain file to be replaced
  122.             rem ----------------------------
  123.  
  124.             echo         %WinPath%\%Grp%.%Type%  to %WinPath%\%Grp%%From%.%Type%
  125.             rename %WinPath%\%Grp%.%Type% %Grp%%From%.%Type%
  126.  
  127.         :MoveToFile
  128.             rem ----------------------------
  129.             rem  Replace file with new file
  130.             rem ----------------------------
  131.  
  132.             echo         %WinPath%\%Grp%%1.%Type% to %WinPath%\%Grp%.%Type%
  133.             rename %WinPath%\%Grp%%1.%Type% %Grp%.%Type%
  134.  
  135.         :DoneTypeLoop
  136.             rem ----------------------------
  137.             rem  Advance Type Loop Variable
  138.             rem ----------------------------
  139.  
  140.             if %Type%==SYM goto DoneGroupLoop
  141.             if %Type%==EXE set Type=SYM
  142.             goto TypeLoop
  143.  
  144.     :DoneGroupLoop
  145.         rem -----------------------------
  146.         rem  Advance Group Loop Variable
  147.         rem -----------------------------
  148.  
  149.         if %Grp%==KRNL386 goto Done
  150.     if %Grp%==KRNL286 goto CheckFor386
  151.         if %Grp%==KERNEL  set Grp=KRNL286
  152.         if %Grp%==USER    set Grp=KERNEL
  153.         if %Grp%==GDI     set Grp=USER
  154.         goto GroupLoop
  155.  
  156. :CheckFor386
  157.     rem -------------------------------------
  158.     rem  Skip KRNL386 if machine isn't a 386
  159.     rem -------------------------------------
  160.  
  161.     if (%Is386%)==(n) goto Done
  162.     set Grp=KRNL386
  163.     goto GroupLoop
  164.  
  165. :Done
  166.  
  167. set DbgPath=
  168. set From=
  169. set Grp=
  170. set Is386=
  171. set NoDPath=
  172. set ToDir=
  173. set Type=
  174. set WinPath=
  175.