home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 1997 / CT_SW_97.ISO / mac / Software / entwickl / win95 / pw32i306.exe / bin / perlw32-uninstall.bat < prev   
DOS Batch File  |  1997-03-21  |  3KB  |  97 lines

  1. @rem = '--*-Perl-*--';
  2. @rem = '
  3. @echo off
  4. if not exist perl.exe goto perlnotthere
  5. if not exist Perl300.dll goto perlnotthere
  6. perl.exe PerlW32-uninstall.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
  7. pause
  8. goto endofperl
  9. @rem ';
  10.  
  11. @INC = qw( ..\Lib ..\Ext );
  12. require 'NT.ph';
  13.  
  14. #(c) 1995 Microsoft Corporation. All rights reserved. 
  15. #    Developed by ActiveWare Internet Corp., http://www.ActiveWare.com
  16.  
  17. print <<'--end--';
  18. PerlW32-uninstall.bat:
  19.   This script will remove the registry entries created by the 
  20.   PerlW32-install.bat script.  The script does not delete files.
  21.   You can re-install by running PerlW32-install.bat again. 
  22. Continue?(Y/N):
  23. --end--
  24.  
  25. $in = <STDIN>;
  26. until ( $in eq "\n" || $in =~ /^y/i ) {
  27.     exit if ( $in =~ /^no?\n$/i );
  28.     print "Do you wish to proceed? [Y/n]";
  29.     $in = <STDIN>;
  30. }
  31.  
  32. #check the registry entries
  33. Win32::RegOpenKeyEx(&HKEY_LOCAL_MACHINE, 'SOFTWARE\ActiveWare\Perl5',
  34.         &NULL, &KEY_ALL_ACCESS, $PerlKey) ?
  35.     print "Retrieving Perl dir information from Registry\n":
  36.     warn "Couldn't retrieve Perl dir information from Registry!!\n";
  37.  
  38. Win32::RegQueryValueEx($PerlKey, 'BIN', &NULL, $type, $bindir);
  39.   
  40. Win32::RegDeleteValue($PerlKey, 'BIN') ?
  41.     print "Deleting BIN value from registry\n" :
  42.     warn "Cannot delete BIN value from registry!!!\n";
  43.  
  44. Win32::RegDeleteValue($PerlKey, 'PRIVLIB') ?
  45.     print "Deleting PRIVLIB value from registry\n" :
  46.     warn "Cannot delete PRIVLIB value from registry!!!\n";
  47.  
  48. Win32::RegDeleteValue($PerlKey, 'HTML-DOCS') ?
  49.     print "Deleting HTML-DOCS value from registry\n" :
  50.     warn "Cannot delete HTML-DOCS value from registry!!!\n";
  51.  
  52. Win32::RegDeleteKey(&HKEY_LOCAL_MACHINE, 'SOFTWARE\ActiveWare\Perl5') ?
  53.     print "Removing Perl from Registry\n" :
  54.     warn "Cannot remove Perl from Registry!!!\n";
  55.  
  56. Win32::RegCloseKey($PerlKey);
  57.  
  58. #remove an associations
  59. if( Win32::IsWinNT() ){
  60.     ($sCSDVersion, $MajorVersion, $MinorVersion, $BuildNumber, $PlatformId) = Win32::GetOSVersion;
  61.     if($MajorVersion >= 4)
  62.     {
  63.         `assoc .pl=`;
  64.         `ftype Perl=`;
  65.     }
  66. }
  67.  
  68. #remove the bin directory from the path.
  69. if( Win32::IsWinNT()){
  70.     Win32::RegOpenKeyEx( &HKEY_LOCAL_MACHINE,
  71.     'SYSTEM\CurrentcontrolSet\control\Session Manager\Environment',
  72.     &NULL, &KEY_ALL_ACCESS, $hkey ) ?
  73.     print "Retrieving Path information from session manager\n":
  74.     warn "Couldn't retrieve path information from session manager!!\n";
  75.  
  76.     Win32::RegQueryValueEx($hkey, 'Path', &NULL, $type, $pathstring);
  77.  
  78.     $pathstring =~ s/$bindir;//g;
  79.  
  80.     Win32::RegSetValueEx($hkey, 'Path', &NULL, $type, $pathstring) ?
  81.     print "Updated path information in session manager\n" :
  82.     warn "Couldn't update path information in session manager!!\n";
  83.  
  84.     Win32::RegCloseKey($hkey);
  85. }
  86.  
  87.  
  88. print "NOTE: The changes to the path will not take effect\n";
  89. print "      until you log off and on again.\n";
  90.  
  91.  
  92. __END__
  93. :perlnotthere
  94. echo Could not find Perl interpreter!!
  95. echo *gasp* *wheez* *choke*
  96. :endofperl
  97.