Copy File Path from Windows Virtual Machine through Finder

Hi Guys,

As I searched the threads I couldn't find a way to build my macro for my specific need.

I would like to right-click a file and copy the path name of a file. BUT not the patchname of my mac. But the path name of my VM running Windows for that file.
For Example
to \Mac\Home\Downloads\test.png

could you give me an idea where I could start working from?

thanks in advance

See here for ways to call a Keyboard Maestro macro from the context menu.

As for changing the Mac path to a Windows equivalent, I'd do that via a Search and Replace action on the system clipboard:

1 Like

thank you for your fast reply! I will look into it and hopefully mac it run.

it works absolutely fine when the file is in the downloads folder.
You have a suggestion for every other file on my system? for example in a different folder?

It would help to know which hypervisor (Parallels, vBox, etc) you are using. But it looks from your paths as though it's mapping your Mac user folder to \Mac\Home in the virtual machine, so you just work to one less level than @ALYB' s search and replace, and change it slightly so you process / to \ in a separate step to allow for sub-folders.

For safety's sake we'll only do the first replacement if it is at the start of the string, just in case you've got a path like /Users/Testuser/Desktop/Users/Testuser/Downloads/test.png (I've seen stranger things!).


Mac to Windows VM Paths.kmmacros (1.8 KB)


This isn't 100% guaranteed -- for example, the path won't work on the Windows side if you Mac path has \ characters in it already -- but it should be enough to get you started.

1 Like

Hey Nige thank you very much for your fast reply!
I use parallels and I see now that some folders may be trickier.

I got 2 external Nvme Drives

my first NVME has dropbox on it
mac: /Volumes/P600/Dropbox
windows: \Mac\Dropbox

my 2nd:
mac: /Volumes/970 EVO/Music
windows: \Mac\970 EVO\Music

and the regular filepath is
For Example
mac: /Users/Testuser/Downloads/test.png
windows: \Mac\Home\Downloads\test.png

so it gehts quite complicated i think, but I am trying to figure it out and appreciate your help too.
KM is crazy and I hope to get my head around how it works, so I can debug my problems myself in future.

The first question is -- why do you want to do this? If it's so that you can open a file or folder selected in the Mac Finder in your Windows VM, there's an often missed way of doing that after you install "Parallels Tools" -- right-click the Finder item, down to "Services", and either "Reveal in Windows" or "Open in Windows".

If you want the paths for some other reason, have a look at what you've written and spot the pattern -- in this case, "if the Mac path starts with x then the Windows path starts with y".

Whenever you see this sort of "If this then that" structure your mind should go straight to KM's "If Then Else" and "Switch/Case". Wars have been fought as to which to use when, but this time we'll use "Switch/Case":

Mac to Win Paths.kmmacros (5.8 KB)


Change the Local_macPath variable in the first action to various paths and see how the Mac and Windows versions compare in the final dialog (you'd usually just work on a single variable but we've duplicated it at the start of the macro so we can see both start and finish values).

I'm sure there are "smarter" ways to do this, but the nice thing about this macro is that it shows how easy it is to translate the statement of what to do to the macro itself, almost verb-to-action and noun-to-variable.

Now it's your turn :wink: Right-clicking a file, copying the path to the clipboard, then running the macro is so last week. Have a look at the list of Tokens for something that will let you highlight the item in the Finder then run the macro, with the token getting the Finder Selection for you.

1 Like

nige your are absolutely amazing! thank you very much.

I worked with "reveal" and "open in windows" with parallel tools but I have a very specific usecase for my taskmanagement system.
to link a file into outlook tasks I have to copy the file from the windows filepath into the task itself.
with parallels that are 3-5 mouseclicks and 2 windows opening.
It should automatically work on every file on my mac.

i will try it out thanks for helping me out!

Ha I got it!! I combined the beginning from "Local SelectedFile" into the macro and it works like a charm.

at the end I added "

so now I can use it with every file also on my external drives :slight_smile:
I also created a right clight context palette for it, i love it

what is kind of weird is. To copy this file into outlook tasks to automaticallly create a "link" from this file I added 3 "///". dont know why...but it works

Three slashes are the shorthand way of writing...


Because you're opening a file, the localhost bit is implied and can be skipped, hence three slashes. At least, that's my understanding of it.


1 Like

Only problem with that is that if you have more than one item selected in the Finder, the path that's returned may vary -- it's probably going to be the first by alphabetical order, but maybe not!

If you are only selecting one file you can use the token directly instead:


@griffman's bang on with his explanation for Macs, but Windows is slightly different. You're adding a "UNC path" to your Outlook task -- those have no protocol, and always start with \\. Then the server name and another \ -- if the server name is missing it evaluates to "this machine". Then it's the share name, and you can see that Parallels is, effectively, making your Mac volumes accessible to Windows via the Mac (with some redirection for your home folder. Finally, it's the path within that share.

Finally -- and probably a silly question -- have you tried simply dragging the files you want to link to from the Finder to your open Outlook task? You may have to wait a beat before dropping them, but it's working every time for me in creating a properly iconed clickable link to the file:


Thanks Nige for asking.
outlook for mac and windows is different yes.
By leftclicking you can copy and paste a file. its quite useful but there may be a downside because of the filesize.
If you rightclick and drag it to your Task it pops up that you can "create a link". The link is not that big and its easier to link larger files from my harddrive without using all the space on my exchange server.
the right click option in Finder is sadly not working. If that may work i would love it. But for creating a link I had to open the file explorer in windows to do it.

running a virtual machine just to use classic outlook is insane. But microsoft has not implemented the essential features into the outlook for mac and also not the new outlook. but that may be another topic

Ah yes, I see what you mean. Working across multiple machines it would never occur to me to link to a local file rather than attach, but now you've got me wondering -- could I link to a share or Dropbox folder...?

I did try dragging from the Finder then holding down Shift-Control before dropping in Parallels, but no luck.

Your "convert path and paste" method is an elegant solution to an annoying problem -- which I shall shamelessly steal ! :wink:

I am very happy that your help benefits your workflow too :smiley:
With outlook you can use any link out of the MS365 system f.e onedrive, msteams chats, onenote etc.
You can also right click drag an drop mails, which is useful if i want to answer the mail later on.

Dropbox may work too if it is a link that you can open in chrome.

hope it simplyfies your workflow too!