![]() Note: If not in the correct path make sure to pass the full path not just the filename. From the Run command ( + R) or via a batch file wscript.exe "toggleicon.vbs". how to change icon of vbs fileįrom a Console Window ( cmd.exe) or via a batch file cscript.exe "toggleicon.vbs". lnk file ' -' Option Explicit Dim objShell, objDesktop, objLink Dim strAppPath, strWorkDir, strIconPath ' -' ' Copy the ICO file to the hard drive ' Const OverwriteExisting = TRUE Dim WshShell: Set WshShell = WScript. ' CreateShortCut.vbs - Create a Desktop Shortcut. Set wshShell = CreateObject ("WScript.Shell") ' CreateShortcut works like a GetShortcut when the shortcut already exists! Set objShortcut = wshShell.CreateShortcut (strTargetPath) ' For URL shortcuts, only ".FullName" and ".TargetPath" are valid. StrTargetPath="C:\Documents and Settings\All Users\Desktop\My Shortcut.lnk". Set Shell = CreateObject ("WScript.Shell") DesktopPath = Shell.SpecialFolders ("Desktop") Set link = Shell.CreateShortcut (DesktopPath & "\test.lnk") link.Arguments = "1 2 3" link.Description = "test shortcut" link.HotKey = "CTRL+ALT+SHIFT+X" link.IconLocation = "app.exe,1" link.TargetPath = "c:\blah\app.exe" link.WindowStyle = 3 link.WorkingDirectory = "c:\blah" link.Save. Under the covers, both the Get-Shortcut and Set-Shortcut cmdlets are using the Wscript.Shell COM object. That's it! Both of the shortcuts are now pointing to the new path. Let's change that shortcut path to C:\Program Files\Notepad++v2 otepad++.exe.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |