We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Send To ... how?

chspit asked
Medium Priority
Last Modified: 2012-06-27

I need to automate the following process by using VB.NET code:

1.Select a jpeg file in a folder
2.Right-click the file with mouse
3.Send To | Bluetooth | camera

Can someone help me with this. I appreciate it if code examples are shown.
Thanks in advance for your help.
Watch Question


well... the "send To" function is really just a folder or directory on your hard drive.

Here is where my "send To" folder is located:

C:\Documents and Settings\_TAD_\SendTo

So when I right-click on a file and "send to" it looks in this directory for an exe, shortcut, folder, etc.



I know where the SendTo folder is. What I don't know is how can I programmatically send a file to an application residing in the 'SendTo' folder.

If I use the following, an error occurs:

File.Copy("C:\myFolder\myFile", "C:\Documents and Settings\user\SendTo\Bluetooth").

Is there another way, or am I doing something wrong?

U want to move that file or want to copy that file there .

(1) Typically you'd put only a shortcut to the application in the SendTo folder, not the application itself.

(2) I use SendTo a lot.  I usually put in links to Notepad, WordPad, Word (WinWord.exe), IE, Acrobat Reader, and even VS.NET 2002 and VS.NET 2003 (so I can easily open a solution in the proper, old or new, version.).

(3) I'm using the term "BlueTooth" in the example below.  You may wish to have something called "Camera" or "Camera 1".

(4) I'm pretty sure this is completely controlled in the registry.  I believe it's the Explorer program that is in control on the SendTo menus, and reading the registry to determine what to do.

Let's go through an example.
You can drop a shortcut to Notepad.exe into your SendTo directory.
Now, when you right-click a file, select Send To, and then select Notepad, the file is opened in Notepad.

How does this happen?  Well ...

Look in the registry using RegEdit.  Navigate to the following key.
This key contains a value with:
  Name: (default)
  Data: %SystemRoot%\system32\NOTEPAD.EXE %1

This tells the system that, for Notepad, the open command is a particular command-line, and this is what the system uses when you use SendTo.  The %1 is replaced by the file name.

Your BlueTooth program should be designed such that (perhaps with some command-line options), you could create a command-line that would take a file and "SendTo" over the bluetooth protocol.  (If it's not designed that way, you could probably SendTo a batch file that can do the right things to call your BlueTooth program.)

Then you must create an entry in the registry:
The Data item for that could be similar to one of the following:
  Data: C:\Program Files\YourCompany\BlueTooth\BlueTooth.exe %1
  Data: C:\Program Files\YourCompany\BlueTooth\BlueTo~1.exe %1
  Data: C:\Program Files\YourCompany\BlueTooth\BlueTooth.exe /open %1
  Data: C:\Program Files\YourCompany\BlueTooth\BlueTooth.exe /open "%1"

[ Caution: You may (or may not) need to use 8.3 MS-DOS style file names in the registry, instead of long names.) ]
[ Caution: There may be many other changes needed in the registry to really make this work.  I just learned this little bit by investigation, and there might be a lot more steps involved -- that is, properly registering an application. ]
[ Caution: I'm reasonable certain that it is the "open" command, which is used by SendTo, and not some other command like "view", "edit", or whatever.  I'm NOT totally certain. ]

You could easily and safely experiment by copying NOTEPAD.EXE to MYTEST.EXE, then creating registry entries for MYTEST.EXE.  Then, when you SendTo MYTEST, it should operate exactly like Notepad.

I have no idea what actual program you'd use to do the copying of the file to the camera via the bluetooth protocol.

Does that fix everything for you?



It doesn't really matter whether to move or copy the file. The problem is: how can i programmatically achieve the following tasks:
1.Select a jpeg file in a folder
2.Right-click the file with mouse
3.Send To | Bluetooth | camera

I think I just can't use 'File.Copy' or 'File.Move' because the destination folder is a .exe.
Fahad MukhtarDistinguished Engineer

It will be good for you if you dont hardcode the "send to" path .and get it from Environment.SpecialFolder.SendTo..

Dim sourceFile As String = "C:\myFolder\myFile.txt"
Dim destDir As String = Environment.GetFolderPath(Environment.SpecialFolder.SendTo) & "\BlueTooth"

Dim destFile As String = destDir & "\myFile.txt"

If Not Directory.Exists(destDir) Then
End If

File.Copy(sourceFile, destFile, True)

Do you REALLY want to programmatically do those three USER-INTERFACE tasks, or do your really just want to programmatically copy a particular jpeg file in a particular folder to a particular bluetooth camera?
In other words, is automating the process of using the user-interface important, or is only the end-result important (getting the file to the camera)?

[ Do you understand the distinction I'm making in this question? ]



Hi farsight

The final result is the most important thing. I just want to programmatically copy a particular jpeg file in a particular folder to a particular bluetooth camera.


Hi Desp

I understood your code, but still can't run it. This is because after I select 'Bluetooth' from 'Sendto', then I have to select 'camera'. So if I just write:

Dim destDir As String = Environment.GetFolderPath(Environment.SpecialFolder.SendTo) & "\Bluetooth\camera"   ...

...nothing happens because the target destination of 'camera' is:

"C:\Program Files\Conceptronic\Bluetooth Software\btsendto_explorer.exe" -BD_ADDR=00:60:57:4d:ad:aa -BD_NAME=Nokia0x203650 -DEV_CLASS=03964134

So if then I write:
Dim destDir As String = "C:\Program Files\Conceptronic\Bluetooth Software\btsendto_explorer.exe"   ...nothing happens either

What can I do? Any ideas please?

For part 1 and 2, you can use the System.IO namespace and the classes Directory, DirectoryInfo, File, and FileInfo.

Use Sysem.Process to call a command-line program, and optionally wait until it's complete.

I think you'll get better answers for the bluetooth-specific parts on the bluetooth forum.

Do you know how to copy a file to the bluetooth device using a command-line command?
If so, show us the command.  Then I'll tell you how can call that programmatically.

Read the docs for btsendto_explorer.exe.  Does it have some other useful command-line arguments?
For help, try:      "C:\Program Files\Conceptronic\Bluetooth Software\btsendto_explorer.exe" -?

Is btsendto_explorer.exe something you've written, or just something you're using?



I am sorry but i don't understand why do i have to use a command-line command if i can copy a file with VB.NET.

'btsendto_explorer.exe' is not something I've written, but an application folder residing in the 'Bluetooth Software' folder. When I try to open it a message box comes up saying "This application cannot be used that way". However, if I drag jpeg file to 'btsendto_explorer.exe' the application runs. But if I copy or move the jpeg file to 'btsendto_explorer.exe' nothing happens.

Now I discovered another folder that links directly to my camera. This is:

'My Bluetooth Places\Entire Bluetooth Neighborhood\Nokia 3650\File Transfer'.

The problem with this System Folder is that its location is not in C: so when I try to run the console with the folowing line, an error occurs saying that it cannot find the destination.

File.Copy("C:\myFolder\myFile", "My Bluetooth Places\Entire Bluetooth Neighborhood\Nokia 3650\File Transfer").

Why is that so?

> I am sorry but i don't understand why do i have to use a command-line command if i can copy a file with VB.NET.
The idea is that if you know some way (any way) to copy files to your camera, we can emulate that in .NET.
As far as I can tell, you haven't told us a way that you _actually_ do this manually.
If you drop files into the "File Transfer" directory, do they automatically get transferred to the device, as you desire?

It looks like we're getting close.  I think we should explore the file copy option some more.
(Equivalent to command:  Copy "C:\myFolder\myFile" "My Bluetooth Places\Entire Bluetooth Neighborhood\Nokia 3650\File Transfer")

> its location is not in C:
That doesn't really matter.  We _do_ need to determine what is the FULL path of "My Bluetooth Places", wherever it is.

Some "My <<something>>" directories are inside the "My Documents" directory.  Is that true of "My Bluetooth Places"?
For example, on my Win2K system, by right-clicking on the title-bar of my "My Documents" directory, and selecting properties, I can tell from the "Target Folder Location" is "C:\Documents and Settings\<<user.computername omitted>>\My Documents".

Can you right-click on "My Bluetooth Places", and select Properties, to determine it's FULL path?

If dropping things in the "File Transfer" directory really works, and you can determine the full path name of the directory, you can use File.Copy() in .NET or just the Copy command to do the work.  If you're still interested in setting up a SendTo option, you'll need to put that command-line in the registry as described earlier.


Hi farsight,

Yes i can do this manually: Send To | Bluetooth | Nokia 3650      ...and it works.

Also, if I drop files manually into the "File Transfer" directory, they automatically get transferred to the device.

"My Bluetooth Places" is not in "My Documents". The Folder can be accessed by opening the "My Computer" folder. If i right-click on "My Bluetooth Places", there are no "properties" options. So I can't determine the path! Is there another way that I don't know of to determine a folder destination?

"My Bluetooth Places" is already in the SendTo Folder as well. So i don't need to add it in the registry, do I?

Part 1 looks promising.  If Part 1 works, skip Part 2.
I wrote Part 2 before I wrote Part 1, but Part 2 leads to a dead end (for me), though more investigation could lead somewere.

--- Part 1 ---
Try this.
(1) Create a file  C:\XyzBlah.txt
(2) Right-click XyzBlah.txt and select: Send To / Bluetooth / Nokia 3650
(3) Assuming that works, search your entire harddrive for the file XyzBlah.txt
(4) The directory where you find it (not C:/ root) is the directory "attached" to the device.  This directory was created when you installed the software for your device.   ( I'll call this directory DirX.)
(5) For my Pocket PC, I can do any of the following operations, and they work the same.  (I delete the file between each step.)
  (a) Right-click C:\XyzBlah.txt / Send To / Mobile Device
  (b) Drag C:\XyzBlah.txt and drop it on the My Computer / Mobile Device "folder".
  (c) Drag C:\XyzBlah.txt and drop it on the directory DirX.

Therefore, once you know DirX, the File.Copy() discussion above should apply, and you know where to copy to.

[ I can copy *.txt files fine.  You may need to use *.jpg files. ]

--- Part 2 ---

> Yes     > Also  
Great!  You should be able to search the registry for "Nokia 3650" and find the command that is used to send files to the phone/camera.

> "My Bluetooth Places" is not in
OK.  I've got a "Mobile Device" entry for my Pocket PC that acts like your "My Bluetooth Places".
My RegEdit entries look like this: http://www.deadcrow.com/pdahtm/SomeOtherKey2.reg.txt
The InProcServer32 is the program that handles it.  For me, note that it's a DLL, not an EXE.
Also note the flags in the Attributes section.  I don't know what they mean.

There's the same entries at HKEY_CLASSES_ROOT\CLSID\{49BF5420-FA7F-11cf-8011-00A0C90A8F78}

"Mobile Device" also shows up at

All these registry entries indicate that they're using Shell Namespace Extensions.  That makes our job more complicated.
[ A bit of info about Shell Namespace Extensions: (Not very useful for us.  Provided just in case you're curious.)
   http://www.microsoft.com/mind/0399/faq/faq0399.asp  ]
I don't know much about this area.  I'm not sure how the Send To item is integrated into Explorer.  I suspect it's one of the interfaces in Figure 7 of that link.  Maybe IDropSource, but that's completely a guess.  So for me, that's a dead end.

> "My Bluetooth Places" is already
Nah, you've already got: SentTo / Bluetooth / Nokia 3650

Does that finally do it?


What about starting a new process?

I haven't had time to test this, but it will only take a minute or two to find out if it works

I'm at home, no VS.Net here  :-(  

Imports System.Diagnostics
Dim p As Process
p.StartInfo.FileName = "C:\Documents and Settings\_TAD_\SendTo\BlueTooth.exe /k C:\myFile.txt"
p.StartInfo.UseShellExecute = True
p.StartInfo.RedirectStandardOutput = False

Can anyone verify or correct this?  You'd think creating a new process should work.

I don't see that a new process would be necessary (though it might be useful for quicker response).

The /k option on BlueTooth.exe looks interesting though.  What's it do?  Where's a list of BlueTooth.exe command-line options?


Hi farsight,

First of all thanks for your interest in my question. I appreciate it.

Unfortunately Part 1 didn't work out. The search only found the original file (C:\root).

I tried to find 'Nokia 3650' in the Registry Editor and it gave me the following path:
-Nokia 3650 OBEX File Transfer

However, when I tried to search for it in C: I couldn't find it. I could not even find the 'Software' folder. Can the above destination be located on C:\ ?

What's beneath "Nokia 3650 OBEX File Transfer"?  Is there anything that points to an EXE, DLL, or to another big long GUID (inside the curly braces {})?   We should be looking at the values of the entries -- similar to DefaultIcon or InProcServer32 in the link http://www.deadcrow.com/pdahtm/SomeOtherKey2.reg.txt .

By the way, you can create something that looks like the text in that link as follows.
(a) In RegEdit
(b) Select a particular registry key  (perhaps "Nokia 3650 OBEX File Transfer", or "Connections").
(c) menu Registry / Export Registry File / ((Make sure the "Export Range" is set to (*) Selected Branch.))
(d) enter a text filename, and click OK.

>  I could not even find the 'Software' folder.
It's not a folder.  The heirarchy in the Registry is completely independent of the heirarchy of the filesystem, so that's not surprising.

I'm running into dead-ends at every turn.
I still think the BlueTooth forum area would be your best bet.

Did you look into that   "BlueTooth.exe /k"   issue?

I'd love it if you post the solution you finally find.

I should warn you.  Be very careful in the registry!  DO NOT change anything unless you're absolutely sure of what you're doing.  And, the standard recommendation is to backup everything before messing with the registry.



/k in DOS basically tells the executable that there is a parameter following that should be used

Quick exeample:

go to your start> Run prompt and type

cmd /k ping localhost

now try the same thing without /k

It also works with /c although there is a distinct difference between /k and /c (/k is better, but I don't remember why).

I *think* /k makes the program run (and stay resident), /c executes the program and returns.

So in this particular case, /c might be a good idea.  But of course we are relaying on my foggy memory (not always a good thing).
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview



I had to content myself with the SendKeys command to simulate the Send To... at least that works.
However, thanks just the same for your help. I'm still giving you the points.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.