Shell Path Problems

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Shell Path Problems

Post by bidgeeman » Fri May 22, 2009 3:39 am

Hi.
Trying to launch a bat file with a shell command from an exe in a folder in windows.

The exe is located C:\Program Files\mp3tool
The bat file is located C:\Program Files\mp3tool\Library

get shell("C:\merge.bat") used to work when the exe and bat file were located in the C:\ directory but now I cannot get the bat file to lauch a all.

I've tried a number of combinations,backslashes but none I tried will execute the bat file.

set the hideConsoleWindows to true
get shell ("C:/Program Files/mp3tool/Library/merge.bat")

Any help would be greatly appreciated.


EDIT: I just tried to put the exe and .bat file together in a new directory, C:/Test, and it ran fine.....but the path C:/Program Files will not work? I don't know what's happening???


Thanks
Bidge

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Fri May 22, 2009 6:59 am

When working with files inside Revolution, you need to use slashes as path separators; but when you're using a function like shell you ned to use the native path separator syntax.

Code: Select all

set the hideConsoleWindows to false  -- true 
get shell ("C:\Program Files\mp3tool\Library\merge.bat")
Until you're sure the shell command works, you're better off setting the hideConsoleWindows to false as you may receive a clue about why something isn't working.
Depending on the batch command processor (cmd.exe or command.com), you may have to put quotes around paths that contain spaces. So if changing the path separator wasn't enough, try this.

Code: Select all

set the hideConsoleWindows to false  -- true 
put quote & "C:\Program Files\mp3tool\Library\merge.bat" & quote into tCommand
get shell(tCommand)
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Fri May 22, 2009 1:36 pm

Thanks for the response Janschenkel. Unfortunately none of those options worked either? I don't know what's happening? The bat file works fine in a drive directly in the C:/ directory but not in C:/Program Files?

Bidge

paul_gr
Posts: 319
Joined: Fri Dec 08, 2006 7:38 pm

Post by paul_gr » Fri May 22, 2009 8:34 pm

Jan's script worked for me.
Might be some sort of permissions problem.
The Program Files directory is not as easy to use as it used to be :)
Using Vista (UAC turned on) I don't have any problems with calling a batch file in Program Files.
Are you using Vista or XP?

cheers
Paul

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Sat May 23, 2009 1:03 am

Hi Paulgr.

Using XP Home.
Its strange. If I put the exe in a folder directly under the C:/ dir everything works fine? It's sounding like my fault so i'll try it once more just to make sure.

Cheers
Bidge

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Sat May 23, 2009 1:12 am

YES!!! It worked.Thank you so much Janschenkel. The second script finally worked for me. I must have had a typo somewhere.

Many many thanks to you all again for the help.
Cheers
Bidge

Post Reply