Login | |
|
 |
Create a file association - 2/18/2005 1:03:36 AM
|
|
 |
|
| |
AzzerShaw
Posts: 25
Score: 0
Joined: 10/22/2004
From:
Status: offline
|
Hi all I am learning VB as Kix is my chosen scripting language but are new infrastrucutre is using VB login scripts for all are XPsp2 clients. I need to create a file association and have found the following code 'Declarations: '(None) 'Code: Public Sub associate(EXT As String, FileType As String, _ FileName As String) On Error Resume Next Dim b As Object Set b = CreateObject("wscript.shell") b.regwrite "HKCR\" & EXT & "\", FileType b.regwrite "HKCR\" & FileType & "\", "MY file" b.regwrite "HKCR\" & FileType & "\DefaultIcon\", FileName b.regwrite "HKCR\" & FileType & "\shell\open\command\", _ FileName & " %L" b.regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Exp lorer\FileExts\" & EXT & "\Application" b.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Exp lorer\FileExts\" & EXT & "\Application", FileName b.regdelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Exp lorer\FileExts\" & EXT & "\OpenWithList\" b.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Exp lorer\FileExts\" & EXT & "\OpenWithList\a", FileName End Sub 'Sample Usage Private Sub Form_Load() associate ".jpg", "JPGFile", _ "C:\Program Files\Accessories\MSPAINT.EXE" Unload Me End Sub But it is coming up with an error about 'Expected (' ? Im confused as to why this isnt working, can anyone help? Thanks Aaron
|
|
| |
|
|
|
|
|