0

(sorry by the english)

I have a app that uses the following command to open files:

java.awt.Desktop.getDesktop().open(new File(caminhoArquivo));

the problem is that i uses a special format to open files (ex.: .TXZ), and if i don´t open the file before by S.O. and says that i want to open that file whit notepad, the app just give a Excption and don´t open..

I´m needing to install this by command like .bat, and add in the registry of windows that i want to open this files in format .XXX by notepad..

Searching here, i found this examples:

Key: HKLM\SOFTWARE\Classes\.TXZ
Value: <default> = “TXZ.Document”

Key: HKLM\SOFTWARE\Classes\TXZ.Document
Value: <default> = “TXZ Document”

Key: HKLM\SOFTWARE\Classes\TXZ.Document\DefaultIcon
Value: <default> = “[!notepad.exe],0?

Key: HKLM\SOFTWARE\Classes\TXZ.Document\shell\open\command
Value: <default> = “[!notepad.exe]” “%1?

and this:

[HKEY_CURRENT_USER\Software\Classes\blergcorp.blergapp.v1\shell\open\command]
@="c:\path\to\app.exe \"%1\""
[HKEY_CURRENT_USER\Software\Classes\.blerg]
@="blergcorp.blergapp.v1"

but how is the first time that i uses something like this, i can´t do my .bat looking like this works.. someone can help me with one example?

PM 77-1
  • 12,933
  • 21
  • 68
  • 111
Chico Luiz
  • 191
  • 1
  • 2
  • 8
  • possible duplicate of [Set file association from batch file](http://stackoverflow.com/questions/8553040/set-file-association-from-batch-file) – Alex K. Sep 02 '13 at 14:27

2 Answers2

0

in batch to open files *.xxx with notepad, use assoc .xxx=txtfile (you know, that *.txt opens with notepad and you can peek with assoc .txt) To "un-assoc" use assoc .xxx=

Stephan
  • 53,940
  • 10
  • 58
  • 91
0
assoc .txz=TXZfile
assoc TXZfile=TXZfile
ftype TXZfile="%SystemRoot%\system32\NOTEPAD.EXE" "%1"
Endoro
  • 37,015
  • 8
  • 50
  • 63
  • after i execute this batch-file, the windows show me the message: "Is not possible to locate the file .txt. You wish create a new file?" and don´t open my file.. what is wrong? – Chico Luiz Sep 02 '13 at 14:52