OMyShortCut.TargetPath = "c:\Program Files\Microsoft Visual Studio\VFP98\vfp6.exe" OMyShortcut.IconLocation = home()+"wizards\graphics\builder.ico" OMyShortCut.WindowStyle = 7 &Minimized 0=Maximized 4=Normal OMyShortCut= WshShell.CreateShortcut(strDesktop+"\Foxtest.lnk") OMyShortcut.TargetPath = "%windir%\notepad.exe"Įxample 2: Add a command-line argument WshShell = CreateObject("WScript.Shell") OMyShortcut.IconLocation = "C:\myicon.ico" OMyShortcut.WindowStyle = 3 &Maximized 7=Minimized 4=Normal OMyShortcut = WshShell.CreateShortcut(strDesktop + "\Sample.lnk") StrDesktop = WshShell.SpecialFolders("Desktop") Example 1 WshShell = CreateObject("Wscript.shell") To run one of these examples, copy the code below into a new program file and run it. In order to run this example, you must have the Windows Script Host installed on your computer. This program demonstrates how to use the Windows Script Host to create a shortcut on the Windows Desktop. Examples to create a desktop shortcut with WSH It is available for Windows NT 4.0 by installing the Windows NT 4.0 Option Pack. The Microsoft Windows Script Host is integrated into Windows 98, Windows 2000, and later versions of the Windows operating system. It also includes several COM automation methods that allow you to do several tasks easily through the Windows Script Host Object Model. Follow these steps to create a Desktop Shortcut. Example 3: Add a URL shortcut to the desktop Visual Basic Script WshShell CreateObject('WScript.Shell') strDesktop WshShell.SpecialFolders ('Desktop') oUrlLink WshShell.CreateShortcut (strDesktop+'\Microsoft Web Site.URL') oUrlLink.TargetPath ' oUrlLink. The WSH is a tool that allows you to run Microsoft Visual Basic Scripting Edition and JScript natively within the base Operating System, either on Windows 95 or Windows NT 4.0. By creating a desktop shortcut, you can save your valuable time that you spent in the access of the original file or application. This article describes how to create desktop shortcuts by using the Microsoft Windows Script Host (WSH) from within Visual FoxPro.Īpplies to: Windows 10 - all editions, Windows Server 2012 R2 Original KB number: 244677 Summary
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |