Command Line Parameters - I figured it out!
Wednesday, July 12, 2006 by frasej | Discussion: DesktopX
1. Use WMI to get the command line parameters.
In the following example, my program is named backup.exe.
What is returned by objItem.CommandLine is the complete
command line, including path to the program.
example of what's returned: "C:\Program Files\Stardock\My Apps\backup.exe" parameters
Note that the path and file name are quoted.
2. Here is the script I use. You'll have to change the program it's looking for.
The variable MyCmd will contain the parameters.
Ex:
strComputer = "."
Set objWMIService = GetObject( _
"winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_Process" & _
" WHERE Name = 'backup.exe'",,48)
For Each objItem In colItems
MyCmd = objItem.CommandLine
Next
x = inStr(1,MyCmd,"backup.exe",1)
If x > 0 Then
MyCmd = mid(MyCmd,x + 12)
Do While left(MyCmd,1) = " "
MyCmd = mid(MyCmd,2)
Loop
End If
3. Export your script as a gadget (.EXE)
4. Save it as "Custom Deployment"
5. Then choose the directory it is to be saved to.
6. To use it, create a shortcut to it and modify the properties of the shortcut to include the parameters you want.
That's all there is to it
It's a bit convoluted, but it does work. Unfortunately, you have to compile it to test it. It can't be tested from within DesktopX Pro.
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!







Reply #1 Wednesday, July 12, 2006 4:47 PM