svn-gvsig-desktop / tags / v1_9_Build_1230 / install / instalador-gvSIG-win / Notas_asociaciacion_archivos.txt @ 47840
History | View | Annotate | Download (16.9 KB)
1 |
|
---|---|
2 |
Pareceser que hay que a?adir unas claves al registro... |
3 |
puede hacerse generando un fichero .reg |
4 |
con las claves preparadas y usando el regedit en modo silencioso |
5 |
|
6 |
el comando es: |
7 |
regedit /s fichero.reg |
8 |
|
9 |
|
10 |
la claves son: |
11 |
HKCR\{ext} = {typeAbr} |
12 |
HKCR\{typeAbr}\ = {typeName} |
13 |
HKCR\{typeAbr}\DefaultIcon = {FileIcon} |
14 |
HKCR\{typeAbr}\shell\open\command = {exeCommand} |
15 |
|
16 |
|
17 |
estas no parecen necesarias: |
18 |
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\{ext}\Application = {exeName} |
19 |
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\{ext}\OpenWithList\a = {exeName} |
20 |
|
21 |
donde: |
22 |
{ext} = ".gvp" |
23 |
{typeAbr} ="gvSIGProject" |
24 |
{typeName} ="gvSIG Project file" |
25 |
{FileIcon} = "gvSIG.ico" || "gvSIG.exe" |
26 |
{exeCommand} = "gvSIG.exe %L" |
27 |
{exeName} = "gvSIG.exe" |
28 |
|
29 |
|
30 |
Ejeplo de fichero .reg: |
31 |
REGEDIT4 |
32 |
|
33 |
[HKEY_CLASSES_ROOT\.gvp] |
34 |
@="gvSIGProject" |
35 |
|
36 |
[HKEY_CLASSES_ROOT\gvSIGProject] |
37 |
@="gvSIG Project file" |
38 |
|
39 |
[HKEY_CLASSES_ROOT\gvSIGProject\DefaultIcon] |
40 |
@="C:\\Archivos de programas\\gvSIG_1.0\\bin\\ico-gvSIG.ico,0" |
41 |
|
42 |
|
43 |
[HKEY_CLASSES_ROOT\gvSIGProject\shell\open] |
44 |
@="Abrir" |
45 |
|
46 |
[HKEY_CLASSES_ROOT\gvSIGProject\shell\open\command] |
47 |
@="C:\\Archivos de programas\\gvSIG_1.0\\bin\\gvSIG.exe \"%1\"" |
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
******************************************************************* |
62 |
URL's y recortes: |
63 |
|
64 |
|
65 |
http://en.wikipedia.org/wiki/Windows_registry |
66 |
|
67 |
http://www.akadia.com/services/windows_registry_tutorial.html |
68 |
|
69 |
http://webtools.live2support.com/windows/ |
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
http://www.freevbcode.com/ShowCode.asp?ID=2799 |
78 |
****************** |
79 |
usando VB |
80 |
|
81 |
|
82 |
Public Sub associate(EXT As String, FileType As String, _ |
83 |
FileName As String) |
84 |
On Error Resume Next |
85 |
Dim b As Object |
86 |
Set b = CreateObject("wscript.shell") |
87 |
b.regwrite "HKCR\" & EXT & "\", FileType |
88 |
b.regwrite "HKCR\" & FileType & "\", "MY file" |
89 |
b.regwrite "HKCR\" & FileType & "\DefaultIcon\", FileName |
90 |
b.regwrite "HKCR\" & FileType & "\shell\open\command\", _ |
91 |
FileName & " %L" |
92 |
b.regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & EXT & "\Application" |
93 |
b.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & EXT & "\Application", FileName |
94 |
b.regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & EXT & "\OpenWithList\" |
95 |
b.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & EXT & "\OpenWithList\a", FileName |
96 |
|
97 |
End Sub |
98 |
|
99 |
'Sample Usage |
100 |
Private Sub Form_Load() |
101 |
associate ".jpg", "JPGFile", _ |
102 |
"C:\Program Files\Accessories\MSPAINT.EXE" |
103 |
Unload Me |
104 |
End Sub |
105 |
|
106 |
|
107 |
**************** |
108 |
|
109 |
|
110 |
http://www.ss64.com/nt/: |
111 |
http://www.ss64.com/nt/ftype.html |
112 |
************************************************************************** |
113 |
FTYPE |
114 |
|
115 |
Display or change the link between a FileType and an executable program |
116 |
|
117 |
Syntax |
118 |
FTYPE fileType=executable_path |
119 |
|
120 |
FTYPE |
121 |
|
122 |
FTYPE fileType |
123 |
|
124 |
FTYPE fileType= |
125 |
|
126 |
Key |
127 |
fileType : The type of file |
128 |
|
129 |
executable_path : The executable program including any command line parameters |
130 |
|
131 |
More than one file extension may be associated with the same File Type. |
132 |
e.g. both the extension .JPG and the extension .JPEG may be associated with the File Type "jpegfile" |
133 |
|
134 |
File Types can be displayed in the Windows Explorer GUI: [View, Options, File Types] however the spelling is usually different to that expected by the FTYPE command e.g. the File Type "txtfile" is displayed in the GUI as "Text Document"and "jpegfile" is displayed as "image/jpeg" |
135 |
|
136 |
Several FileTypes can be linked to the same executable application, but |
137 |
one FileType cannot be linked to more than one executable application. |
138 |
|
139 |
FTYPE file type will display the current executable program for that file type. |
140 |
|
141 |
FTYPE without any parameters will display all FileTypes and the executable program for each. |
142 |
|
143 |
Defining command line parameters |
144 |
|
145 |
It is almost always necessary to supply command line parameters so that when a document is opened not only is the relevant application loaded into memory but the document itself also loaded into the application. To make this happen the filename of the document must be passed back to the application. |
146 |
|
147 |
Command line parameters are exactly like batch file parameters, %0 is the executable program and %1 will reference the document filename |
148 |
|
149 |
so a simple command line might be: |
150 |
|
151 |
MyApplication.exe "%1" |
152 |
|
153 |
If any further parameters are required by the application they can be passed as %2, %3. To pass ALL parameters to an application use %*. To pass all the remaining parameters starting with the nth parameter, use %~n where n is between 2 and 9. |
154 |
|
155 |
The FileType should always be created before making a File Association |
156 |
|
157 |
For example: |
158 |
|
159 |
FTYPE htmlfile="C:\PROGRA~1\Plus!\MICROS~1\iexplore.exe" -nohome |
160 |
ASSOC .html=htmlfile |
161 |
|
162 |
FTYPE pagemill.html=C:\PROGRA~1\Adobe\PAGEMI~1.0\PageMill.exe "%1" |
163 |
ASSOC .html=pagemill.html |
164 |
|
165 |
FTYPE rtffile="C:\Program Files\Windows NT\Accessories\WORDPAD.EXE" "%1" |
166 |
ASSOC .rtf=rtffile |
167 |
|
168 |
FTYPE word.rtf.8="C:\Program Files\Microsoft Office\Office\winword.exe" /n |
169 |
ASSOC .rtf=word.rtf.8 |
170 |
|
171 |
Switching a File Association between multiple applications |
172 |
|
173 |
If you have multiple applications that use the same file extension, the ASSOC command can be used to switch the file extension between the different FileTypes. |
174 |
|
175 |
Deleting a FileType |
176 |
|
177 |
Specify executable_path=nothing and the FTYPE command will delete the executable_path for that FileType. |
178 |
For example: |
179 |
FTYPE htmlfile= |
180 |
|
181 |
Backing up your FileTypes |
182 |
|
183 |
FTYPE >backup_types.txt |
184 |
ASSOC >backup_ext.txt |
185 |
|
186 |
Restoring your FileTypes from a Backup |
187 |
|
188 |
FOR /F "tokens=* delims=" %G IN (backup_types.txt) DO FTYPE %G |
189 |
FOR /F "tokens=* delims=" %G IN (backup_ext.txt) DO ASSOC %G |
190 |
|
191 |
This will recreate the CLASS id's in the registry at HKey_Classes_Root\.<file extension> |
192 |
If you put the commands above in a batch file change the %G to be %%G |
193 |
|
194 |
Using File associations at the command line |
195 |
|
196 |
If you have a file association between .DOC and Word for Windows then at a command prompt you can open a document with any of the following commands: |
197 |
|
198 |
Start "My Document.doc" |
199 |
"Monthly Report.doc" |
200 |
JULY.DOC |
201 |
|
202 |
note that the file extension must be supplied for this to work |
203 |
|
204 |
"True to type - Of a plant, or group of plants, which matches the accepted description of the cultivar to which it is assumed to belong" |
205 |
|
206 |
Related Commands: |
207 |
|
208 |
ASSOC - Change file extension associations |
209 |
Batch file to list the application associated with a file extension |
210 |
ASSOCIAT - One step file association (Resource Kit) |
211 |
|
212 |
************************************************************************** |
213 |
|
214 |
http://www.ss64.com/nt/assoc.html |
215 |
************************************************************************* |
216 |
|
217 |
ASSOC |
218 |
|
219 |
Display or change the association between a file extension and a fileType |
220 |
|
221 |
Syntax |
222 |
ASSOC .ext = [fileType] |
223 |
ASSOC |
224 |
ASSOC .ext |
225 |
ASSOC .ext = |
226 |
|
227 |
Key |
228 |
.ext : The file extension |
229 |
fileType : The type of file |
230 |
|
231 |
A file extension is the last few characters in a FileName after the period. |
232 |
So a file called JANUARY.HTML has the file extension .HTML |
233 |
|
234 |
The File extension is used by Windows NT to determine the type of information stored in the file and therefore which application(s) will be able to display the information in the file. File extensions are not case sensitive and are not limited to 3 characters. |
235 |
|
236 |
More than one file extension may be associated with the same File Type. |
237 |
e.g. both the extension .JPG and the extension .JPEG may be associated with the File Type "jpegfile" |
238 |
|
239 |
At any one time a given file extension may only be associated with one File Type. |
240 |
e.g. If you change the extension .JPG so it is associated with the File Type "txtfile" then it's normal association with "jpegfile" will disappear. Removing the association to "txtfile" does not restore the association to "jpegfile" |
241 |
|
242 |
File Types can be displayed in the Windows Explorer GUI: [View, Options, File Types] however the spelling is usually different to that expected by the ASSOC command e.g. the File Type "txtfile" is displayed in the GUI as "Text Document"and "jpegfile" is displayed as "image/jpeg" |
243 |
|
244 |
The command ASSOC followed by just a file extension will display the current File Type for that extension. |
245 |
|
246 |
ASSOC without any parameters will display all the current file associations. |
247 |
|
248 |
ASSOC with ".ext=" will delete the association for that file extension. |
249 |
|
250 |
Did you leave the Always Use This Program To Open This File option turned on? |
251 |
To change it back so it prompts you to specify a program each time, just delete the association for that file type |
252 |
ASSOC .ext= |
253 |
[where .ext is the file extension]. |
254 |
Now when you double-click on a file of that type, the system will ask you what program you want to use. |
255 |
|
256 |
Using the ASSOC command will edit values stored in the registry at HKey_Classes_Root\.<file extension> |
257 |
Therefore it's possible to use registry permissions to protect a file extension and prevent any file association changes. |
258 |
|
259 |
Examples: |
260 |
|
261 |
Viewing file associations: |
262 |
|
263 |
ASSOC .txt |
264 |
ASSOC .doc |
265 |
ASSOC >backup.txt |
266 |
|
267 |
Editing file associations: |
268 |
|
269 |
ASSOC .txt=txtfile |
270 |
ASSOC .DIC=txtfile |
271 |
ASSOC .html=Htmlfile |
272 |
|
273 |
Deleting a file association: |
274 |
|
275 |
ASSOC .html= |
276 |
|
277 |
Repair .REG and .EXE file associations: |
278 |
|
279 |
ASSOC .EXE=exefile |
280 |
ASSOC .REG=regfile |
281 |
|
282 |
Digging through CLASSES_ROOT entries often reveals more than one shell for the same application, for example the Apple Quick Time player has two entries, one to "open" (which gives an annoying nag screen) and one to just "play" the QT file: |
283 |
[HKEY_CLASSES_ROOT\MOVFile\shell\open] and [play] |
284 |
|
285 |
In cases like this you can change the default action e.g. |
286 |
[HKEY_CLASSES_ROOT\MOVFile\shell] |
287 |
@="play" |
288 |
|
289 |
"Of all forms of caution, caution in love is perhaps the most fatal to true happiness" - Bertrand Russell |
290 |
|
291 |
Related: |
292 |
|
293 |
FTYPE - Edit file types (used in file extension associations) |
294 |
Batch file to list the application associated with a file extension |
295 |
ASSOCIAT - One step file association (Resource Kit) |
296 |
Q162059 - Associate Internet Explorer with MS Office files |
297 |
JSIFAQ - Tip 9715 - List File Types with executable path |
298 |
|
299 |
**************************************************************** |
300 |
|
301 |
|
302 |
http://www.ss64.com/nt/associate.html |
303 |
********************************************************************** |
304 |
ASSOCIATE.exe (Resource Kit) |
305 |
|
306 |
One step file association. |
307 |
|
308 |
This utility does the job of both ASSOC and FTYPE, in one step. ASSOCIATE assigns an extension directly with an executable application. This is done by automatically adding a new FileType to the system registry. |
309 |
|
310 |
Syntax |
311 |
ASSOCIATE .ext filename [/q /d /f] |
312 |
|
313 |
Key |
314 |
.ext : Extension to be associated. |
315 |
filename : Executable program to associate .ext with. |
316 |
/q : Quiet - Suppress interactive prompts. |
317 |
/f : Force - Force overwrite or delete without questions. |
318 |
/d : Delete - Delete the association. |
319 |
|
320 |
A file extension is the last few characters in a FileName after the period. |
321 |
So a file called JANUARY.HTML has the file extension .HTML |
322 |
|
323 |
The File extension is used by Windows NT to determine the type of information stored in the file and therefore which application(s) will be able to display the information in the file. File extensions are not case sensitive and are not limited to 3 characters. |
324 |
|
325 |
Example: adding a File Association |
326 |
|
327 |
To add the File Type "SQLfile"=Notepad.exe and also set the File Association of .SQL="SQLfile" run this command: |
328 |
|
329 |
ASSOCIATE .SQL Notepad.exe |
330 |
|
331 |
Example: Removing a File Association |
332 |
|
333 |
ASSOCIATE .SQL /d |
334 |
|
335 |
Note that /d will delete the File Association but will NOT delete the File Type. |
336 |
|
337 |
File types created by Associate.exe are always given a name in the form xxxfile, where xxx is the file extension. |
338 |
|
339 |
"There are three roads to ruin; women, gambling and technicians. The most pleasant is with women, the quickest is with gambling, but the surest is with technicians" - Georges Pompidou |
340 |
|
341 |
Related Commands: |
342 |
|
343 |
ASSOC Change file extension associations |
344 |
FTYPE Display or modify file types used in file extension associations |
345 |
********************************************************************** |
346 |
|
347 |
|
348 |
|
349 |
|
350 |
WINDOWS 98 |
351 |
|
352 |
|
353 |
http://groups.google.com/group/alt.msdos.batch/browse_thread/thread/556321da29c9ca2e/e60e3330cd284b99?lnk=gst&q=file+association&rnum=2#e60e3330cd284b99 |
354 |
*************************************************************************** |
355 |
|
356 |
|
357 |
De: William Allen - ver perfil |
358 |
Fecha: Mi? 26 mar 2003 14:28 |
359 |
Correo electr?nico: "William Allen" <_inval...@mayfly13.fsnet.co.uk> |
360 |
Grupos: alt.msdos.batch |
361 |
Sin calificar |
362 |
Valoraci?n: |
363 |
mostrar opciones |
364 |
Responder | Responder al autor | Reenviar | Imprimir | Mensaje individual | Mostrar mensaje original | Notificar abuso | Buscar mensajes de este autor |
365 |
|
366 |
"Robert Mark Bram" wrote in message |
367 |
> I recently asked this question in alt.msdos.batch.nt -- but I need an answer |
368 |
> for Win 98.. |
369 |
|
370 |
> Can use a batch file to create a windows file association? |
371 |
|
372 |
Yes. Windows 95/98/ME users can use the Windows 98 Resource Kit |
373 |
utility ASSOCIAT.EXE (cloned from the NT4 Resource Kit), which will |
374 |
operate with the Windows 95/98/ME registries to create file associations |
375 |
very easily. ASSOCIAT.EXE provides an informative ERRORLEVEL and |
376 |
is designed for use in Batch files. Downloadable free from the Microsoft FTP site: |
377 |
ftp://ftp.microsoft.com/Services/TechNet/samples/ps/win98/Reskit/FILE/ |
378 |
|
379 |
and click on file: ASSOCIAT.EXE |
380 |
|
381 |
For syntax help with using ASSOCIAT.EXE, use the /? switch |
382 |
associat /? |
383 |
|
384 |
Full documentation, usage instructions, and syntax examples for Batch |
385 |
usage of all the Windows 98 Resource Kit Batch tools (which you can |
386 |
use in Windows 95 and ME, too): |
387 |
ftp://ftp.microsoft.com/Services/TechNet/samples/ps/win98/reskit/help... |
388 |
This is a fully indexed and searchable compiled help file. Although |
389 |
each utility responds to the usual /? for brief help, this main file has |
390 |
huge detail. When you have the file, look in the Contents section |
391 |
under "Scripting Tools". |
392 |
|
393 |
|
394 |
************************************************************************* |
395 |
|
396 |
PARA TODOS LOS WINDOWS |
397 |
|
398 |
http://www.robvanderwoude.com/index.html |
399 |
http://www.robvanderwoude.com/files/defopen.txt |
400 |
|
401 |
defopen.bat |
402 |
|
403 |
Create a default file association to Notepad and add "Open with Notepad", "Print with Notepad" and "Command Prompt Here" options to popup menus |
404 |
|
405 |
************************************************************************ |
406 |
@ECHO OFF |
407 |
:: No parameters required |
408 |
IF NOT [%1]==[] GOTO Syntax |
409 |
|
410 |
:: Choose the correct command processor for the current operating system |
411 |
SET _cmd= |
412 |
:: Variable to add shortcut to menu entry (NT only, |
413 |
:: since COMMAND.COM cannot echo an ampersand) |
414 |
SET _= |
415 |
ECHO.%COMSPEC% | FIND /I "command.com" >NUL |
416 |
IF NOT ERRORLEVEL 1 SET _cmd=command.com /e:4096 |
417 |
ECHO.%COMSPEC% | FIND /I "cmd.exe" >NUL |
418 |
IF NOT ERRORLEVEL 1 SET _cmd=cmd.exe |
419 |
IF [%_cmd%]==[cmd.exe] SET _=^& |
420 |
|
421 |
:: Create a temporary .REG file |
422 |
> "%Temp%.\DefOpen.reg" ECHO REGEDIT4 |
423 |
>>"%Temp%.\DefOpen.reg" ECHO. |
424 |
ECHO Adding "Open with Notepad" entry |
425 |
>>"%Temp%.\DefOpen.reg" ECHO [HKEY_CLASSES_ROOT\*\shell\open] |
426 |
>>"%Temp%.\DefOpen.reg" ECHO @="%_%Open with Notepad" |
427 |
>>"%Temp%.\DefOpen.reg" ECHO. |
428 |
>>"%Temp%.\DefOpen.reg" ECHO [HKEY_CLASSES_ROOT\*\shell\open\command] |
429 |
>>"%Temp%.\DefOpen.reg" ECHO @="notepad.exe \"%%1\"" |
430 |
>>"%Temp%.\DefOpen.reg" ECHO. |
431 |
ECHO Adding "Print with Notepad" entry |
432 |
>>"%Temp%.\DefOpen.reg" ECHO [HKEY_CLASSES_ROOT\*\shell\print] |
433 |
>>"%Temp%.\DefOpen.reg" ECHO @="%_%Print with Notepad" |
434 |
>>"%Temp%.\DefOpen.reg" ECHO. |
435 |
>>"%Temp%.\DefOpen.reg" ECHO [HKEY_CLASSES_ROOT\*\shell\print\command] |
436 |
>>"%Temp%.\DefOpen.reg" ECHO @="notepad.exe /p \"%%1\"" |
437 |
>>"%Temp%.\DefOpen.reg" ECHO. |
438 |
|
439 |
:: If neither COMMAND.COM nor CMD.EXE then skip this step |
440 |
IF [%_cmd%]==[] ECHO Skipping "Command Prompt Here" entry |
441 |
IF [%_cmd%]==[] GOTO Merge |
442 |
|
443 |
ECHO Adding "Command Prompt Here" entry |
444 |
:: Add Command Prompt Here for files |
445 |
>>"%Temp%.\DefOpen.reg" ECHO [HKEY_CLASSES_ROOT\*\shell\prompt] |
446 |
>>"%Temp%.\DefOpen.reg" ECHO @="Command Prompt Here" |
447 |
>>"%Temp%.\DefOpen.reg" ECHO. |
448 |
>>"%Temp%.\DefOpen.reg" ECHO [HKEY_CLASSES_ROOT\*\shell\prompt\command] |
449 |
>>"%Temp%.\DefOpen.reg" ECHO @="%_cmd% /k cd \"%%1\\..\"" |
450 |
>>"%Temp%.\DefOpen.reg" ECHO. |
451 |
:: Add Command Prompt Here for directories |
452 |
>>"%Temp%.\DefOpen.reg" ECHO [HKEY_CLASSES_ROOT\Directory\shell\prompt] |
453 |
>>"%Temp%.\DefOpen.reg" ECHO @="Command Prompt Here" |
454 |
>>"%Temp%.\DefOpen.reg" ECHO. |
455 |
>>"%Temp%.\DefOpen.reg" ECHO [HKEY_CLASSES_ROOT\Directory\shell\prompt\command] |
456 |
>>"%Temp%.\DefOpen.reg" ECHO @="%_cmd% /k cd \"%%1\"" |
457 |
>>"%Temp%.\DefOpen.reg" ECHO. |
458 |
:: Add Command Prompt Here for drives |
459 |
>>"%Temp%.\DefOpen.reg" ECHO [HKEY_CLASSES_ROOT\Drive\shell\prompt] |
460 |
>>"%Temp%.\DefOpen.reg" ECHO @="Command Prompt Here" |
461 |
>>"%Temp%.\DefOpen.reg" ECHO. |
462 |
>>"%Temp%.\DefOpen.reg" ECHO [HKEY_CLASSES_ROOT\Drive\shell\prompt\command] |
463 |
>>"%Temp%.\DefOpen.reg" ECHO @="%_cmd% /k cd \"%%1\"" |
464 |
>>"%Temp%.\DefOpen.reg" ECHO. |
465 |
|
466 |
:: Merge the temporary .REG file |
467 |
:Merge |
468 |
START /WAIT REGEDIT /S "%Temp%.\DefOpen.reg" |
469 |
|
470 |
:: Delete the temporary .REG file |
471 |
DEL "%Temp%.\DefOpen.reg" |
472 |
|
473 |
:: Ready |
474 |
GOTO End |
475 |
|
476 |
:Syntax |
477 |
ECHO. |
478 |
ECHO DefOpen.bat, Version 3.00 for Windows 95/98/NT 4/2000/XP |
479 |
ECHO Adds a default association: when a file without a file association |
480 |
ECHO is double-clicked, it will be opened with Notepad. |
481 |
ECHO Adds three new entries to the right mouse button menu as well: |
482 |
ECHO "Open with Notepad", "Print with Notepad" and "Command Prompt Here". |
483 |
ECHO. |
484 |
ECHO Usage: DEFOPEN |
485 |
ECHO. |
486 |
ECHO Written by Rob van der Woude |
487 |
ECHO http://www.robvanderwoude.com |
488 |
ECHO Notepad registry tip courtesy of Regedit.com |
489 |
ECHO http://www.regedit.com |
490 |
|
491 |
:: Clean up variables and quit |
492 |
:End |
493 |
SET _cmd= |
494 |
SET _= |
495 |
***************************** |
496 |
|