drag & drop "open with.." additional params

MilesAhead

Eclectician
Vista Guru
Gold Member
Anyone know if it is possible to create a shortcut drag & drop target so that when I drag a program and drop it on the shortcut, then select "open with" the shortcut that is dropped on can insert the name of the dropped program into the command line params? IOW, say I want a shortcut that opens a program at x y 100 100 no matter what I drop on it. My program knows how to do the positioning but it needs to read the name of the dropped program as well as the rest of the params in its shortcut. I've tried MyProg.exe "%1" x y in the target line but when I drop anything on it and do Open With I get "%1" not found. Is there a magic bullet?
 

My Computer

System One

  • Manufacturer/Model
    HP Pavilion m9515y
    CPU
    Phenom X4 9850
    Memory
    8 GB
    Graphics Card(s)
    Some Radeon Cheapie with 512 MB Ram
    Monitor(s) Displays
    CRT
    Screen Resolution
    1280x1024
    Hard Drives
    750 GB SATA 3G
    2 SIIG Superspeed docks w/WD Caviar Black Sata II or III
Hi MilesAhead,

I think that to do this you will need to create your shortcut to some form of script file ( VBScript, Powershell etc. that can then call your program and pass the parameters as needed.

I can't help with the script but it should be achievable for someone who knows more than I do, You may want to try posting directly to one of the MS script newsgroups.

sorry can't be of more help but hopefully maty point you in the right direction

may seem silly but have you tried %1, %2, %3 etc.
 
Last edited by a moderator:

My Computers

System One System Two

  • Operating System
    Windows 10 Pro x64 Latest Release Preview
    Monitor(s) Displays
    Acer G276HL 27", (DVi) + Samsung 39" HDTV (HDMI)
    Screen Resolution
    2 x 1920x1080 @50Hz
  • Manufacturer/Model
    Real World Computers (Custom by Me)
    CPU
    AMD FX8350 Vishera 8 Core @4GHz
    Motherboard
    Asus M5A78L-M USB3
    Memory
    32GB [4x8GB] DDR3 1600 MHz
    Graphics card(s)
    Asus nVidia GTX750TI-OC-2GD5 (2GB DDR5)
    Sound Card
    ASUS Xoner DG + SPDIF to 5.1 System + HDMI
    Monitor(s) Displays
    Samsung 32" TV
    Screen Resolution
    1920 x 1080
    Hard Drives
    Internal
    Crucial CT256MX100SSD1 256GB SSD,
    Seagate ST2000DM001-1CH1 2TB,

    External (USB3)
    Seagate Backup+ Hub BK SCSI Disk 8TB
    2.5/3.5 Hot Swap Cradle, USB3 + eSata (client HDDs)
    NAS 4TB
    PSU
    Aerocool Templarius Imperator 750W 80+ Silver
    Case
    AeroCool X-Warrior Red Devil Tower
    Cooling
    Hyper103 CPU, Rear 120mm, Front 2x120mm, Side 2x120mm
    Internet Speed
    68 MB Down 18.5 MB Up
    Other Info
    Six Sensor Auto / Manual Digital cooling (Fan) control with Touch control Panel
may seem silly but have you tried %1, %2, %3 etc.

Thanks for the reply.

I could just do a .cmd file to call my program:

@echo off
Myprog.exe "%1" param2 param3 param4

I was just hoping I could do it on the shortcut Target line.
One would think there'd be a way to insert a symbolic substitution
but this is Windows we're talkin' about so... :)
 
Last edited:

My Computer

System One

  • Manufacturer/Model
    HP Pavilion m9515y
    CPU
    Phenom X4 9850
    Memory
    8 GB
    Graphics Card(s)
    Some Radeon Cheapie with 512 MB Ram
    Monitor(s) Displays
    CRT
    Screen Resolution
    1280x1024
    Hard Drives
    750 GB SATA 3G
    2 SIIG Superspeed docks w/WD Caviar Black Sata II or III
It's the ghost in the machine :D or is it The gremlins
 

My Computers

System One System Two

  • Operating System
    Windows 10 Pro x64 Latest Release Preview
    Monitor(s) Displays
    Acer G276HL 27", (DVi) + Samsung 39" HDTV (HDMI)
    Screen Resolution
    2 x 1920x1080 @50Hz
  • Manufacturer/Model
    Real World Computers (Custom by Me)
    CPU
    AMD FX8350 Vishera 8 Core @4GHz
    Motherboard
    Asus M5A78L-M USB3
    Memory
    32GB [4x8GB] DDR3 1600 MHz
    Graphics card(s)
    Asus nVidia GTX750TI-OC-2GD5 (2GB DDR5)
    Sound Card
    ASUS Xoner DG + SPDIF to 5.1 System + HDMI
    Monitor(s) Displays
    Samsung 32" TV
    Screen Resolution
    1920 x 1080
    Hard Drives
    Internal
    Crucial CT256MX100SSD1 256GB SSD,
    Seagate ST2000DM001-1CH1 2TB,

    External (USB3)
    Seagate Backup+ Hub BK SCSI Disk 8TB
    2.5/3.5 Hot Swap Cradle, USB3 + eSata (client HDDs)
    NAS 4TB
    PSU
    Aerocool Templarius Imperator 750W 80+ Silver
    Case
    AeroCool X-Warrior Red Devil Tower
    Cooling
    Hyper103 CPU, Rear 120mm, Front 2x120mm, Side 2x120mm
    Internet Speed
    68 MB Down 18.5 MB Up
    Other Info
    Six Sensor Auto / Manual Digital cooling (Fan) control with Touch control Panel
I've tried MyProg.exe "%1" x y in the target line but when I drop anything on it and do Open With I get "%1" not found. Is there a magic bullet?

When you drop a file onto a shortcut, the path of the dropped file is automatically added to the command line.

For example I just did an experiment here...
Normally the command to print from metapad is:
c:\pathto\metapad.exe /p d:\pathto\myfile.txt

So I made a desktop shortcut with the command:
c:\pathto\metapad.exe /p
(notice there is no %1)
Then I dropped a textfile onto that shortcut and it printed it.

I think in your case, when you included %1 in your shortcut's command line, the name of the dropped file ends up being included twice in what actually gets executed. So try it without the "%1", only with the other parameters or command line switches your program wants.
 

My Computer

System One

  • Manufacturer/Model
    home assembled
    CPU
    Intel Q9450 quad core
    Motherboard
    Asus P5Q Pro, Intel P45 chipset
    Memory
    4GB : 2 x 2GB G.Skill DDR2 800MHz
    Graphics Card(s)
    Gigabyte 9600GT
    Sound Card
    Realtek onboard the mobo
    Monitor(s) Displays
    BenQ 24"
    Screen Resolution
    1920 x 1200
    Hard Drives
    2 of Samsung HD501LJ SATA2 500GB
    and a few IDE hard disks on USB for backups
    PSU
    Corsair TX-650 and APC UPS
    Case
    Antec P180
    Cooling
    OCZ Vendetta2
So you're saying the param gets stuck on the end of the line?
See I don't understand why it can't be positioned with a placeholder.
Oh well, it's just an idea. Instead of drag & drop it would prolly be
easier to use a DosKey macro. Then I can use $1 $2 to position the
params within the constant params. You'd think positional substitution
would've been thought necessary by now but I guess it's make yet
another wrapper for the wrapper. :)
 

My Computer

System One

  • Manufacturer/Model
    HP Pavilion m9515y
    CPU
    Phenom X4 9850
    Memory
    8 GB
    Graphics Card(s)
    Some Radeon Cheapie with 512 MB Ram
    Monitor(s) Displays
    CRT
    Screen Resolution
    1280x1024
    Hard Drives
    750 GB SATA 3G
    2 SIIG Superspeed docks w/WD Caviar Black Sata II or III
Back
Top