Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- @REM this script requires admin permissions
- net session >nul 2>&1
- IF ERRORLEVEL 1 (GOTO:ERROR_AdminPermissions)
- @ECHO.
- @ECHO.
- @ECHO Beginning association script...
- @REM save previous associations and filetypes
- @ECHO Creating a reference of existing associations...
- @ECHO ON
- assoc > "OLD_assoc.cfg"
- ftype > "OLD_ftype.cfg"
- @ECHO OFF
- @REM cmdline args for desired editor
- SET MyEditor="C:\Programs\Vim\vim80\gvim.exe" "%%1"
- SET src_cmd=%MyEditor%
- SET txt_cmd=%MyEditor%
- @REM source extensions
- @ECHO.
- @ECHO Association source file types
- assoc .c=srcfile
- assoc .cpp=srcfile
- assoc .cs=srcfile
- assoc .cxx=srcfile
- assoc .h=srcfile
- assoc .json=srcfile
- assoc .make=srcfile
- assoc .mk=srcfile
- assoc .php=srcfile
- assoc .pl=srcfile
- assoc .ps=srcfile
- assoc .py=srcfile
- assoc .r=srcfile
- assoc .rc=srcfile
- assoc .res=srcfile
- assoc .scp=srcfile
- assoc .scr=srcfile
- assoc .tup=srcfile
- assoc .xml=srcfile
- assoc .y=srcfile
- assoc .yxx=srcfile
- @REM text extensions
- @ECHO.
- @ECHO Association text file types
- assoc .cfg=txtfile
- assoc .config=txtfile
- assoc .git=txtfile
- assoc .gitattributes=txtfile
- assoc .gitignore=txtfile
- assoc .gitmodules=txtfile
- assoc .inf=txtfile
- assoc .ini=txtfile
- assoc .log=txtfile
- assoc .settings=txtfile
- assoc .txt=txtfile
- @REM make filetype<->cmd association
- @ECHO.
- @ECHO Associating editor with filetypes
- ftype srcfile=%src_cmd%
- ftype txtfile=%txt_cmd%
- @ECHO.
- @ECHO.
- @ECHO Finished.
- GOTO:END
- :ERROR_AdminPermissions
- @ECHO This script requires elevated permissions.
- @ECHO Please run this script in an admin shell.
- :END
- @ECHO.
- @PAUSE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement