Join Forum | Login | Today's Posts | Tutorials | Windows 10 Forum | Windows 8 Forum

 Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

# Windows 7: Setting the window icon for a command prompt window

 27 Jan 2015 #1 swiftie Windows 7 Ultimate x64 140 posts Hampshire, England Setting the window icon for a command prompt window I have a set of scheduled tasks, all of which run programs written in Open Object REXX. Consequently, the Command Prompt windows where these tasks runs inherit their icons (at the top left of the window) from the rexx.exe program that handles my scripts. This means that all of these REXX tasks display the same icon in the taskbar, or system area, which is unhelpful. I doubt that there's any way of influencing the icon from my REXX code itself, but is there some sort of wrapper program that I could run, which would allow me to choose different icons for each of the scheduled tasks? Perhaps by running my REXX from some program other than a Command Prompt window? I'll also go and ask the REXX community, so we'll see who gets there first! I realise that this is something of a long shot, but if I don't ask, I'll never get... My System Specs
 .
 27 Jan 2015 #2 Pyprohly Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan 620 posts Sydney, NSW Quote: Originally Posted by swiftie [I]s there some sort of wrapper program that I could run, which would allow me to choose different icons for each of the scheduled tasks? You're asking us how to create a Shortcut. My System Specs
 27 Jan 2015 #3 swiftie Windows 7 Ultimate x64 140 posts Hampshire, England Quote: Originally Posted by Pyprohly You're asking us how to create a Shortcut. I thought I was asking how to create a shortcut in the Actions tab of the Task Scheduler. I bet this can't be done. But since that wasn't obvious, is there some way to influence the window icon that you get when a scheduled task results in a Command Prompt window? My System Specs
 .
 27 Jan 2015 #4 Pyprohly Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan 620 posts Sydney, NSW We're talking about these, yes? You can influence these icons by creating a Shortcut to a program and altering the icon in the Shortcut's properties. Schedule the Shortcut to run and your custom icon will be seen. My System Specs
 28 Jan 2015 #5 swiftie Windows 7 Ultimate x64 140 posts Hampshire, England No, that's an ordinary command prompt window. I'm OK tailoring those. I'm talking about the window that you get when a scheduled task runs an executable that doesn't have a GUI. Then you get this: Note the icon at the top left. Other than that, it looks exactly like a command prompt window. Associated with this window, you get one of these in the taskbar (the one with the keys): Imagine having two or three of these... which one to click? I've engineered these scheduled tasks to have something meaningful in their title, so I can distinguish them, but I'd prefer distinct icons, if possible. My System Specs
 28 Jan 2015 #6 Pyprohly Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan 620 posts Sydney, NSW It does not matter if we're talking about a command prompt or some Rexx script. Most applications will inherit the icon of a Shortcut file. Shortcuts are the only way to influence the icon of a program (aside from directly hacking into the executable, ripping it's icon out and replacing it with new one). I tested with a Python script: made a shortcut to it, changed the icon of the Shortcut; and sure enough, the GUI-less program ran with the icon the Shortcut was set to. Easy as Py. And you'll find it's easy as Rexx once you try the same. My System Specs
 28 Jan 2015 #7 swiftie Windows 7 Ultimate x64 140 posts Hampshire, England OK, you created your shortcut. Now try running it as a scheduled task. If you manage this, and it shows your tailored icon, then I'd love to know how you launched a shortcut from the task scheduler! My System Specs
 29 Jan 2015 #9 swiftie Windows 7 Ultimate x64 140 posts Hampshire, England Quote: Originally Posted by Pyprohly Oh. I understand where you're coming from now... Thank you for that excellent description. I'll try out your suggestion. I wonder if something like VisualBasic (VBScript) has the ability to interact with desktop objects? If so, perhaps it could do the equivalent of double-clicking a desktop icon. Unfortunately, I'm a rank beginner at VBS. My System Specs
 29 Jan 2015 #10 Pyprohly Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan 620 posts Sydney, NSW Quote: Originally Posted by swiftie If so, perhaps [VBScript] could do the equivalent of double-clicking a desktop icon. Swiftie, you are a genius, I'm jealous I didn't think to use a Windows script as a Shortcut. Well the VBScript will just invoke the actual Shortcut to the target script file, seeing as .lnks are the only known way of altering a display icon (as far as I'm concerned). Here's the VBScript "shortcut" script you mention: Code: Dim strCommand, objShell strCommand = "C:\Location\to\script.rex.lnk" Set objShell = CreateObject("WScript.Shell") objShell.Run strCommand,1 (Where "script.rex.lnk" would then point to your actual Rexx script file.) Solution tested and approved; it works perfectly, not only for scripts but any program! My System Specs