1

I'm using FileMaker Pro and would like to be able to open a folder in Windows Explorer given a folder path that isn't 100% complete.

We have a Contracts drive where our jobs get saved = X:\ in that folder there is 100 or so folders that all start with a unique number, but also have a job description after the number. I want to send the command from FMP that opens the folder just given the number (e.g. X:\1234*).

From FMP I can use a Send Event function that can run command prompt. It could also run BAT files. I have this at the moment:

"cmd /c explorer Y:" & Jobs::JobNumber & "*"

(the parts in quotes are literal and outside returns the value stored in a field)

but that just opens Explorer at My Computer. So I need a way to find the full folder path given the job number and then open that full folder path.

Any help would be awesome. Thanks

3

In cmd it is up to individual commands to interpret wild-cards, and explorer doesn't do this. When launched with an invalid directory name, explorer starts in the default directory, as you observed.

You can get cmd to expand a wild-card by using a for statement, as in:

for /d %d in (X:\1234*) do explorer %d

So your run string needs to be created with something like:

"cmd /c for %d in (Y:\" & Jobs::JobNumber & "*) do explorer %d"

I don't know how FileMaker Pro schedules system commands, but it's possible that you may need to double the % signs, as in a batch file. If there are spaces in the expanded directory name, you will need to generate quotes around the explorer parameter.

1

In cmd, the easiest way to do this is as follows:

First, use CD to navigate to the desired folder. You can use TAB to autocomplete names, and press it multiple times if there are more matches until you get the correct one.

Once you are there, you can simply type the following command to open an explorer window from the current path:

start .

So in your case with your script, that would make it something like this:

x:
cd & Jobs::JobNumber
start .

Likewise, if you are in the explorer and want to start a command prompt from that location, go to the addressbar, and instead of the addressbar, just type cmd and press enter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.