c# - Create shortcut from vb.net on Windows 7 box (64 bit) -


I am trying to create a desktop shortcut with the vb.net code on Windows 7 box (64 bit). The following code works on XP, but when run on Win7 I just get turned off messaging applications work explaining:

  import IWshRuntimeLibrary dim WshShell WshShellClass = new WshShellClass dim MyShortcut IWshRuntimeLibrary as the .IWshShortcut in 'MyShortcut = CTYPE (WshShell.CreateShortcut ( "C: desktop shortcut" Win 7 MyShortcut = CTYPE ( "\ Users \ Public \ Desktop \ iexplore.lnk C"), IWshRuntimeLibrary.IWshShortcut WshShell.CreateShortcut () Will be made on: \ Documents and Settings \ All Users \ Desktop \ iexplore.lnk "), IWshRuntimeLi brary.IWshShortcut) MyShortcut.TargetPath = "C: \ Program Files \ Internet Explorer \ iexplore.exe" 'specified target application full path MyShortcut.Description = "better ways to make a shorcut codes on any idea or Win7 box?   

Windows 7 64-bit here As 32-bit compiled and it works:

  import IWshRuntimeLibrary Module Module1 Sub Main () Dim WshShell WshShell = new WshShell dim MyShortcut as IWshRuntimeLibrary.IWshShortcut MyShortcut = CTYPE (WshShell.CreateShortcut aS ( "C: \ Users \ Public \ Desktop \ Dah Browser.lnk"), IWshRuntimeLibrary.IWshShortcut) MyShortcut.TargetPath = "C: \ Program Files \ internet Explorer \ iexplore.exe" 'specified target application full path MyShortcut .Description = "IE" MyShortcut.Save () End Sub End Module  

Note: I am closing the UAC as an administrator.

Also note that I changed WshShellClass to WshShell


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -