Shell() help?

dtinsley

Registered User.
Local time
Today, 14:13
Joined
May 3, 2006
Messages
21
Ok, this is very odd. I am running a small DOS executable from within a db. I am using the shell command. The DOS exe is suppose to create a *.txt file. The file creates the *.txt file if I launch it from Windows Explorer. Howeve, if I use the Shell() command, it does not create the *.txt file. What can I use in place of the Shell() command to execute the file as if it was being executed from within Windows Explorer. I don't understand why it isn't working with the Shell() command...
 
What does the DOS exe look for? Sounds like it could be a path problem.


Some prefer the ShellExecute method as an alternative...look here
 
the DOS exe looks for a *.csv file that is located in the same dir as the exe is in. if i launch it from windows explorer, it works fine. just not from the shell command...
 
Yeah it is probably a thing with the startup folder... I am unsure however how to fix this...

Can you send parameters into the exe?
Have you concidered running a bat file instead? it would look something like:
C: (or the drive where the exe resides)
Cd\...\...\...\ (fill in the full path where the exe resides)
Execute exe

That might help, but I am guessing....

Just thinking along here. CSV => txt ... What does it do? Cannot you do this yourselve in Access?
 
the EXE performs some very complex calculations. it is an exe created in fortran and i don't really want to re-write the code for that exe. the exe dosent use parameters, so i can not figure out what the problem is... will try a bat file, maybe that will work, who knows...
 
in explorer, you can specify a startup folder by accessing the file properties. By default, the startup folder is where the file is located. Adjust the startup folder property of your .exe so that it specifies the proper location and try again.
 
i just don't get it at all. here is what i have so far.
 

Attachments

any help appreciated. i just dont understand why it isn't working as it should. if you run the file Lmmev6.exe from explorer, you will see it creates 2 new files. but, when run from within access, it just dosent work!
 
as I suspected, it is a path problem. Check out GHudson's file browsing/opening example here

In addition to passing the string argument for the open file method, you will also need to modify the path statement to reference the appropriate directory. Worked like a champ for me.
 
Double clicking or starting the exe from a doscommand doesnt seem to produce a text file? Oh wait ... DAT files... OK...
 
If you use this in a bat file, it works perfectly...

C:
cd\namliaM\DayOps2
Lmmev6.exe

If you run it

C:\namliaM\DayOps2\Lmmev6.exe

I get these errors... not sure what they mean, but it is obviously looking for the PDIN.DAT file on the C:\ where I was starting the Bat file...
forrtl: severe (29): file not found, unit 1, file C:\PDIN.DAT
Image PC Routine Line Source
Lmmev6.exe 0040B179 Unknown Unknown Unknown
Lmmev6.exe 0040AFD7 Unknown Unknown Unknown
Lmmev6.exe 0040A1B4 Unknown Unknown Unknown
Lmmev6.exe 0040A5E9 Unknown Unknown Unknown
Lmmev6.exe 00403534 Unknown Unknown Unknown
Lmmev6.exe 00401060 Unknown Unknown Unknown
Lmmev6.exe 0042DF49 Unknown Unknown Unknown
Lmmev6.exe 00425274 Unknown Unknown Unknown
kernel32.dll 77E8141A Unknown Unknown Unknown

GL...
 
Bodisathva said:
as I suspected, it is a path problem. Check out GHudson's file browsing/opening example here

In addition to passing the string argument for the open file method, you will also need to modify the path statement to reference the appropriate directory. Worked like a champ for me.

Bodisathva: i still cant figure out what i am doing wrong. anyway you can sedn me your working example?
 
Bodisathva, nevermind about sending the code. i see whaere i was going in the wrong direction. i found my error and have the code working. thanks for the help!
 
***Bodisathva stands in center of room staring at ceiling***:confused:


what's that noise?:confused:


:D
 
namlaim: sorry about that. thanks for the help, too. i was trying to avoid using a *.bat file if possible because the customer can locate the *.exe and its dependency files where ever they wanted, so the file path would not always be the same. plus, i just wanted to know why my exsisting code was broken. didnt mean to just ignore you, thanks for the help.
 

Users who are viewing this thread

Back
Top Bottom