powershell - Link a file extension to an app -


i wondering if possible create powershell script link file extension application.

for example: .ntb extension has opened using following application default: c:\program files\smart technologies\education software\notebook.exe

why need script ask? indeed done using run , ticking default box. need perform on 150+ computers. i'd think run script when booting once.

i newbie when comes powershell, if give "small" start, grateful.

for scripted solution i'd use cmd built-ins assoc , ftype:

$prg = 'c:\program files\smart technologies\education software\notebook.exe' $ext = '.ntb'  & cmd /c "ftype smart.notebook=`"$prg`" %1" & cmd /c "assoc $ext=smart.notebook" 

the above can run on remote hosts via invoke-command cmdlet:

invoke-command -computer hosta,hostb,... -scriptblock {   $prg = 'c:\program files\smart technologies\education software\notebook.exe'   $ext = '.ntb'    & cmd /c "ftype smart.notebook=`"$prg`" %1"   & cmd /c "assoc $ext=smart.notebook" } 

otherwise you'll have edit registry, in case deployment via group policy preferable, others have pointed out.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -