?
Solved

Execute file long filenames

Posted on 1998-11-17
17
Medium Priority
?
179 Views
Last Modified: 2010-04-04
I have a problem using execute file with long filenames, when the filename contains space(s) e.g.
"Long File Name.exe"
It executes properly, but then halts and gives a strange error reading.
(delphi3)
0
Comment
Question by:zonk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
  • +3
17 Comments
 
LVL 4

Expert Comment

by:erajoj
ID: 1347144
Just enclose it with quotation marks:

  "c:\program files\blab\myapp.exe"

?
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1347145
I mean:
 
  sPath := '"c:\program files\blab\myapp.exe"';
  DoWhateverYouWant( sPath );

/// John
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1347146
It is not nessesarily a problem of the quotes or the ShellExecute or whatever at all. I remember I installed one of my projects to "Program files\...", and it ran, but gave a handful of errors in the end. You can try: running the same program from Start/Run, and see if you get the same.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:Matvey
ID: 1347147
Oh, just to say that when I installed the project to some simple directory, like "C:\mydir", it ran perfectly. I never got to the root of the problem though. I think it was some db app...
0
 
LVL 17

Expert Comment

by:inthe
ID: 1347148
hello Zonk,
it is possible you could use the win32 api GetShortPathName to execute files in a long path.it returns the 8:3 dos format name for your long file name/path. like in dos you get progra~1 for program files directory
Barry
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1347149
Zonk

I created a sample project with a lon file name and then created a second that executed the the first I used the shellexecute API and all's well that end's well in both D3 and D4

ShellExecute(Handle, 'open', 'Long File Name.Exe', '', 'C:\program files\testing\longfilename\', SW_SHOWNORMAL);

Does your execute code look like so, maybe post your execute code for us to take a look at.

Later
BoRiS
0
 

Author Comment

by:zonk
ID: 1347150
No, my instruction looks like this:
ExecuteFile ('name of the file.exe','','',1);

I will try shell execute, maybe that works.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1347151
Hello y'all...

ShellExecute() will do the job for sure :)

Cheers,
Viktor
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1347152
Zonk

If you use the Shell Execute command make sure you add ShellAPI to your uses clause

uses
Windows, Forms, ..., ShellAPI;
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1347153
yup, that's what I'm talk'n 'bout ;-)

Cheers,
Viktor
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1347154
John, how's everything going around ya??

Vik
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1347155
Still breathing...
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1347156
:)
0
 

Author Comment

by:zonk
ID: 1347157
So who gets the points now?
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1347158
Zonk

Well did the ShellExecute I gave you work, Then the points are mine, but if one of the other examples worked then the points belong to them...

Later
BoRiS
0
 

Author Comment

by:zonk
ID: 1347159
Yes the shell execute works nicely.
And I gues Boris was the first to post, so post an answer and I will credit the points.
0
 
LVL 4

Accepted Solution

by:
BoRiS earned 200 total points
ID: 1347160
Zonk

Here you go, just a simple answer, glad I could help...

Later
BoRiS
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question