LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

trouble with launchexecutable() file path name

Solved!
Go to solution

Hi,

 

I am using launchexecutable() to open a .ini file in notepad. 

If i specify the path name as launchexecutable(NOTEPAD.EXE  D:\\Documents and Settings\\T0128779\\Bureau\\filename.ini) the file opens perfectly. The problem i have is that i have a string that stores the path name but without two slashes between for example the string contains the path name as D:\Documents and Settings\T0128779\Bureau\filename.ini

 

launchexecutable doesnt seem to work with this string. What am i doing wrong?

 

Thanks,

 

Rohit

 

0 Kudos
Message 1 of 8
(3,909 Views)

just to add the string is created using GetDir() and MakePathName(,,)

so my question really is will launchexecutable() work with a path name that has only one slash between directories and if not how do i add a second slash? thanks a ton;

0 Kudos
Message 2 of 8
(3,902 Views)

It's supposed to work with the string, see here

 

What's the error you're getting?

0 Kudos
Message 3 of 8
(3,895 Views)

Hi Wolfgang, thanks for the link. I used Wendy's method and now my string has two slashes but still isnt working.

When i pass the path through the string i get the msg 'Cannot find file filename.ini Do you want to create it?'

But when i pass the path directly without the string the file opens. Could it be the quotes "" in the string?

 

Thanks 

0 Kudos
Message 4 of 8
(3,891 Views)

Yes, in the argument of LaunchExecutable you should enclose the file name in quotes because it contains spaces.

0 Kudos
Message 5 of 8
(3,889 Views)

yes this is how i have it..

launchexecutable("NOTEPAD.EXE stringname")

 

but the stringname also has the path in quotes is that the problem?

0 Kudos
Message 6 of 8
(3,885 Views)
Solution
Accepted by topic author sinnas

@sinnas wrote:

launchexecutable("NOTEPAD.EXE stringname")


This will not work. You should have a look at the CVI examples using LaunchExecutable. There you will find how to do it:

 

sprintf (tempstr, "Notepad.exe %s", stringname);

LaunchExecutable (tempstr);

0 Kudos
Message 7 of 8
(3,883 Views)

oh great thank you!!

0 Kudos
Message 8 of 8
(3,881 Views)