Scripts Solutions...
Posted: 16 Mar 2009 10:33
DESCRPTION:
SAVES A BACKUP COPY OF YOUR ASSOC AND
FTYPE FILE ASSOCIATION TYPES TO THE SCRIPT ITSELF.
USAGE:
COPY AND PASTE THE CODE BELOW SAVE AS
FTYPE.BAT OR FTYPE.CMD MAKE SURE TO COPY
THE LAST BLANK LINE WITH THIS CODE
THE BLANK LINE IS NEEDED AS THE LAST LINE
IN THE SCRIPT FOR THE NEW DATA
CLICK THE SCRIPT ONCE TO POPULATE THE DATA
CLICK TWICE TO LOAD THE DATA FROM THE SCRIPT
RIGHT CLICK IN A TEXT EDITOR AFTER
THE THE FIRST EXECUTION TO VIEW THE
POPULATED BACKUP DATA
UPDATING:
RIGHT CLICK THE SCRIPT IN A TEXT EDITOR &
DELETE EVERYTHING BELOW
"DELETE EVERYTHING BELOW THIS LINE" ETC...
SAVE THE FILE AND CLICK
TO REGENERATE NEW BACKUP DATA
WARNING!!!
TAKE CARE WHEN MODIFYING THIS SCRIPT NOTHING
ABOVE THE DELETE EVERYTHING BELOW THIS LINE
SHOULD BE MODIFIED IF YOU DO NOT KNOW HOW TO
WORK WITH WHITE SPACES, TABS
ETC..
IF SPACES ARE ADDED TO THE ENDS OF THE VARIABLES
THE FILE WILL MISPRINT AN ERROR MISMATCHING
YOUR FILE TYPE ASSOCIATIONS I HAVE ENCOUNTERED
THIS ERROR BEFORE AND IT IS EASILY FIXABLE
JUST ANNOYING IF IT HAPPENS
SO FOLLOW THE DIRECTIONS AS STATED AND YOU'RE GOOD
NOTES:
AFTER THE FIRST EXECUTION AND THE DATA HAS BEEN
SAVED PUT THE SCRIPT IN A FOLDER AND THE NEXT TIME
YOU NEED TO LOAD A BACKUP OF YOUR FTYPES AND
ASSOC YOU NOW HAVE A SCRIPT TO DO SO, IF ANY
FURTHER EXPLANATION IS NEEDED JUST ASK, AS WELL IF
ANYONE NEEDS ANY HELP WITH THEIR OWN SCRIPTS
FEEL FREE TO ASK.
GOOD DAY ALL.
P.S. MAKE SURE TO CHECK THIS SCRIPT IN A TEXT EDITOR
BEFORE EXECUTING TO SEE THAT THERE ARE NO BLANK
SPACES AT THE ENDS OF ANY OF THE LINES I JUST COPIED
AND PASTED THIS CODE TO MAKE SURE IT WORKS AND
THIS FORUM SEEMS TO LIKE TO SPIT OUT SPACES AT
THE ENDS OF THE LINES SO MAKE SURE THERE ARE NO
SPACES AT THE ENDS OF THE LINES AND IF SO DELETE THEM
FIRST
SAVES A BACKUP COPY OF YOUR ASSOC AND
FTYPE FILE ASSOCIATION TYPES TO THE SCRIPT ITSELF.
USAGE:
COPY AND PASTE THE CODE BELOW SAVE AS
FTYPE.BAT OR FTYPE.CMD MAKE SURE TO COPY
THE LAST BLANK LINE WITH THIS CODE
THE BLANK LINE IS NEEDED AS THE LAST LINE
IN THE SCRIPT FOR THE NEW DATA
CLICK THE SCRIPT ONCE TO POPULATE THE DATA
CLICK TWICE TO LOAD THE DATA FROM THE SCRIPT
RIGHT CLICK IN A TEXT EDITOR AFTER
THE THE FIRST EXECUTION TO VIEW THE
POPULATED BACKUP DATA
UPDATING:
RIGHT CLICK THE SCRIPT IN A TEXT EDITOR &
DELETE EVERYTHING BELOW
"DELETE EVERYTHING BELOW THIS LINE" ETC...
SAVE THE FILE AND CLICK
TO REGENERATE NEW BACKUP DATA
WARNING!!!
TAKE CARE WHEN MODIFYING THIS SCRIPT NOTHING
ABOVE THE DELETE EVERYTHING BELOW THIS LINE
SHOULD BE MODIFIED IF YOU DO NOT KNOW HOW TO
WORK WITH WHITE SPACES, TABS
ETC..
IF SPACES ARE ADDED TO THE ENDS OF THE VARIABLES
THE FILE WILL MISPRINT AN ERROR MISMATCHING
YOUR FILE TYPE ASSOCIATIONS I HAVE ENCOUNTERED
THIS ERROR BEFORE AND IT IS EASILY FIXABLE
JUST ANNOYING IF IT HAPPENS
SO FOLLOW THE DIRECTIONS AS STATED AND YOU'RE GOOD
NOTES:
AFTER THE FIRST EXECUTION AND THE DATA HAS BEEN
SAVED PUT THE SCRIPT IN A FOLDER AND THE NEXT TIME
YOU NEED TO LOAD A BACKUP OF YOUR FTYPES AND
ASSOC YOU NOW HAVE A SCRIPT TO DO SO, IF ANY
FURTHER EXPLANATION IS NEEDED JUST ASK, AS WELL IF
ANYONE NEEDS ANY HELP WITH THEIR OWN SCRIPTS
FEEL FREE TO ASK.
GOOD DAY ALL.
P.S. MAKE SURE TO CHECK THIS SCRIPT IN A TEXT EDITOR
BEFORE EXECUTING TO SEE THAT THERE ARE NO BLANK
SPACES AT THE ENDS OF ANY OF THE LINES I JUST COPIED
AND PASTED THIS CODE TO MAKE SURE IT WORKS AND
THIS FORUM SEEMS TO LIKE TO SPIT OUT SPACES AT
THE ENDS OF THE LINES SO MAKE SURE THERE ARE NO
SPACES AT THE ENDS OF THE LINES AND IF SO DELETE THEM
FIRST
Code: Select all
@ECHO OFF
:CHECK*BACKUPS
FOR /F "SKIP=14 TOKENS=31 EOL=a DELIMS= " %%A IN (FTYPE.BAT) DO (SET FTYPE=%%A)
IF "%FTYPE%" == "1" (GOTO :INSTALL*BACKUPS) ELSE (GOTO :MAKE*BACKUPS)
:MAKE*BACKUPS
ECHO :: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 1 >> FTYPE.BAT
FTYPE >> FTYPE.BAT
ASSOC >> FTYPE.BAT
GOTO :EOF
:INSTALL*BACKUPS
FOR /F "SKIP=15 EOL=. TOKENS=* DELIMS=" %%B IN (FTYPE.BAT) DO FTYPE %%B
FOR /F "TOKENS=* DELIMS=" %%C IN ('FINDSTR /B /L "." FTYPE.BAT') DO ASSOC %%C
GOTO :EOF
:DELETE*EVERYTHING*BELOW*THIS*LINE*DO*NOT*DELETE*THIS*LINE*LEAVE*THE*15TH*LINE*BLANK*THE*15TH*LINE*IS*WHERE*THE*NEW*DATA*WILL*START