[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Execute file long filenames

Posted on 1998-11-17
17
Medium Priority
?
180 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

649 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