Tuesday, October 2, 2018

Asocijacija fajlova

U cmd.exe unesite:

C:\Users\Korisnik>assoc .txt
.txt=txtfile

C:\Users\Korisnik>ftype txtfile
txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1







Here's a script that worked for me on Windows 10
$exts=@("txt","log","csproj","sql","xml","flobble")
echo "## setting up file associations"
foreach ($ext in $exts){
    $extfile=$ext+"file"
    $dotext="." + $ext
    cmd /c assoc $dotext=$extfile
    cmd /c "ftype $extfile=""C:\Program Files (x86)\Notepad++\notepad++.exe"" %1"
    echo ""
}
  • Needs to be run in an admin powershell windows.
  • Explorer immediately refreshed and showed new file icons.
Thanks to the other answers for the information I needed to make this work.


Ili preko Registry-ja:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\notepad_pp]
@=""

[HKEY_CLASSES_ROOT\notepad_pp\shell]

[HKEY_CLASSES_ROOT\notepad_pp\shell\open]

[HKEY_CLASSES_ROOT\notepad_pp\shell\open\command]
@="\"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\" \"%1\""

[HKEY_CLASSES_ROOT\.pl]
@="notepad_pp"




I have achieved the correct FILE ASSOCIATION using these cmd commands. (just an example):
REG ADD "HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open\command" /v @ /t REG_SZ /d "\"C:\\Program Files\\Noteepad++\\notepad++.exe\" \"%1\"" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt" /v "Application" /t REG_SZ /d "notepad++.exe" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithList" /v "g" /t REG_SZ /d "notepad++.exe" /f

assoc .txt=MyCustomType
ftype MyCustomType="C:\Program Files\Noteepad++\notepad++.exe" "%1"
(it's better to put them in .bat file)



key HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/App Paths/<progname>: "" = <appPath>

key HKCR/Applications/<progname>/SupportedTypes: <fileExt> = ""
key HKCR/<fileExt>: "" = <progID>

key HKCR/<progID>/OpenWithList/<progName>
key HKCR/<fileExt>/OpenWithList/<progName>
key HKCR/SystemFileAssociations/<fileExt>/OpenWithList/<progName>

delete key and subkey at HKCU/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/fileExts/<fileExt>





No comments:

Post a Comment

Коментар: