I’m trying to launch a Windows app from inside my Xojo app. The Windows app is called RNR2_Import.exe.
If the Windows app is stored in the same folder as my Xojo app, all I need to do is execute this code.
[code] Dim sh As New Shell
sh.Execute("RNR2_Import.exe")[/code]
But the Windows app is stored in a parent fold above the Xojo app.
MyAppFolder
________RNR2_Import.exe
________RR2Folder
-----------------MyXojoApp (This is where I want to launch the sh.Execute from to run RNR2_Import.exe from
How do you write the code so that the sh.Execute code will run in the folder above you application folder.
I tried this code, but it does not work.
[code] Dim f as folderitem = getfolderitem("").parent.child("RNR2_Import.exe")
Dim sh As New Shell
sh.Execute("f")[/code]
That did not work.
I also tried to run this code and it did not work either
[code] Dim f as folderitem = getfolderitem("").parent.child("RNR2_Import.exe")
Dim sh As New Shell
sh.execute "dir /x "+f.shellpath[/code]
Thank you for your response. My app is not stored in the Applications folder. The app I want to launch the shell.execute is stored in a subfolder in a different folder of the hard drive…
The sh.Execute code to launch RNR2_Import.exe would be run from the MyApp.exe application.
So I am not sure how to write the code so that it executes the RNR2_Import.exe application.
I always end up writing a batch file and executing that. First change to correct drive, then CD to correct folder, then the executable.
Or create batch file in your program’s folder ‘CD …’ to bump up one level, then the exe name on next line. You might manage it on one command line directly via shellexecute something like 'CD … & RNR2_Import.exe . ( Sorry I don’t have time to test right now ).