Guest User

decorrupt_explorer.sh

a guest
Jul 7th, 2012
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.87 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # adapt this if your windows directory is not C:\windows
  4. WINFOLDER="windows"
  5.  
  6. rename_folder()
  7. {
  8.   CORRUPT=$1
  9.   CORRECTED=$2
  10.  
  11.   echo
  12.   echo Checking for "$BASE"/"$CORRUPT"...
  13.   if [ ! -d "$BASE"/"$CORRUPT" ]; then
  14.     echo "$BASE"/"$CORRUPT" doesn\'t exist. No need to fix.
  15.   else
  16.     if [ -e "$BASE"/"$CORRECTED" ]; then
  17.       echo Hmm, "$BASE"/"$CORRECTED" already exists.
  18.       echo Renaming to "$BASE"/"$CORRECTED".weird...
  19.       mv "$BASE"/"$CORRECTED" "$BASE"/"$CORRECTED".weird
  20.     fi
  21.     echo -n "Correcting "$BASE"/"$CORRUPT" to "$BASE"/"$CORRECTED"... "
  22.     mv "$BASE"/"$CORRUPT" "$BASE"/"$CORRECTED"
  23.     echo OK.
  24.   fi
  25.   echo Finished.
  26.   sleep 1
  27. }
  28.  
  29. cat << EOF
  30. This script intends to fix folder corruption caused by Windows Explorer
  31. either directly or by having been invoked by other programs such as
  32. Messenger or Internet Explorer.
  33.  
  34. Affected folders are among others:
  35. C:\Program Files -> C:\!$!$!$!$.pfr
  36. C:\Program Files\Internet Explorer -> C:\!$!$!$!$.pfr\!$!$!$!$.ier
  37. C:\Program Files\Outlook Express -> C:\!$!$!$!$.pfr\!$!$!$!$.oer
  38. C:\Windows\Application Data -> C:\Windows\$!$!$!$!.app
  39. C:\Windows\Desktop -> C:\Windows\!$!$!$!$.dsk
  40.  
  41. Note that this script makes some changes to your data.
  42. I tried to design it as secure as possible, but still: NO WARRANTY !!
  43.  
  44. And note that in case you've got a localized version of Windows,
  45. this script will rename the corrupted folders to the international naming,
  46. *not* to the naming that your installation had before.
  47. If this is the case, then you might want to choose to not run this script.
  48.  
  49. And DON'T try to boot into Windows before fixing the damage.
  50. I haven't tried it, but doing so might damage your Windows install
  51. irreparably.
  52.  
  53. Andreas Mohr
  54.  
  55. Do you want to execute this script [Y/N] ?
  56. EOF
  57. echo -n "> "
  58. read ans
  59. RES="`echo $ans|tr -d "\r"`"
  60. if [ "$RES" != "y" -a "$RES" != "Y" ]; then
  61.   echo Hmm. Seems like you want to stay corrupted, then \;-\)
  62.   echo Have a nice day !
  63.   exit
  64. fi
  65. echo Please enter the directory location where your Windows partition is mounted:
  66. echo -n "> "
  67. read ans
  68. RES="`echo $ans|tr -d "\r"`"
  69.  
  70. BASE=$RES
  71.  
  72. if [ -z "`find "$BASE" -maxdepth 1 -iname "command.com"`" ]; then
  73.   echo Sorry, "$BASE" is not the mount directory of a valid Windows partition. Aborting...
  74.   exit
  75. fi
  76.  
  77. rename_folder \!\$\!\$\!\$\!\$.pfr Program\ Files
  78. rename_folder Program\ Files/\!\$\!\$\!\$\!\$.acr Program\ Files/Accessories
  79. rename_folder Program\ Files/\!\$\!\$\!\$\!\$.cfr Program\ Files/Common\ Files
  80. rename_folder Program\ Files/\!\$\!\$\!\$\!\$.ier Program\ Files/Internet\ Explorer
  81. rename_folder Program\ Files/Internet\ Explorer/\!\$\!\$\!\$\!\$.cwr Program\ Files/Internet\ Explorer/Connection\ Wizard
  82. rename_folder Program\ Files/\!\$\!\$\!.me Program\ Files/Online\ Services
  83. rename_folder Program\ Files/Online\ Services/\!\$\!\$\!\$.cis Program\ Files/Online\ Services/CompuServe
  84. rename_folder Program\ Files/\!\$\!\$\!\$\!\$.mp2 Program\ Files/Windows\ Media\ Player
  85. rename_folder Program\ Files/\!\$\!\$\!\$\!\$.nmr Program\ Files/NetMeeting
  86. rename_folder Program\ Files/\!\$\!\$\!\$\!\$.oer Program\ Files/Outlook\ Express
  87.  
  88. rename_folder $WINFOLDER/\$\!\$\!\$\!\$\!.app $WINFOLDER/Application\ Data
  89. rename_folder $WINFOLDER/Application\ Data/\$\!\$\!\$\!.ms $WINFOLDER/Application\ Data/Microsoft
  90. rename_folder $WINFOLDER/\!\$\!\$\!\$\!\$.\$\!\$ $WINFOLDER/Favorites
  91. # dunno what to rename this to
  92. #rename_folder $WINFOLDER/Favorites/\!\$\!\$\!\$\!\$.\$\!\$ $WINFOLDER/Favorites/XXXXX
  93. rename_folder $WINFOLDER/\!\$\!\$\!\$\!\$.dsk $WINFOLDER/Desktop
  94.  
  95. rename_folder $WINFOLDER/web/\!\$\!\$wall.ie4 $WINFOLDER/web/Wallpaper
  96. rename_folder $WINFOLDER/web/Wallpaper/\!\$\!\$\!\$\!\$.wal $WINFOLDER/web/Wallpaper/Wallpapr.htm
  97. echo
  98. echo Yay, finished. Cross your fingers \! :-\)
  99. #PASTED FROM http://web.archive.org/web/20020211013822/http://home.arcor.de/andi.mohr/download/decorrupt_explorer
Advertisement
Add Comment
Please, Sign In to add comment