By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,157 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

Space in file name

P: n/a
Good morning to you all,
The problem : i use the shell command and i used, with W98, to use the DOS
name when there was a space in the file / folder name ( ex : Program~1 for
Program Files). With XP, I don't find that sort of replacement name when i
run command and then DIR command to reach the DOS names of the files /
folder. How could i do to use correctly the shell command with files /
folders with a space in their name ? Thank you.

--
_______________________________________

Site personnel : http://perso.wanadoo.fr/dimphoto
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Tue, 20 Apr 2004 09:17:27 +0200, "alain" <no*******@wanadoo.fr>
wrote:
Good morning to you all,
The problem : i use the shell command and i used, with W98, to use the DOS
name when there was a space in the file / folder name ( ex : Program~1 for
Program Files). With XP, I don't find that sort of replacement name when i
run command and then DIR command to reach the DOS names of the files /
folder. How could i do to use correctly the shell command with files /
folders with a space in their name ? Thank you.


Try enclosing the name of the file (with the complete path) within
quotes.

mike
Nov 12 '05 #2

P: n/a
Mike,
I proceeded so :
Dim Myapp as string
Dim App as variant
Myapp = "C:\Program~1\Access_2000\Office\Msaccess.exe
C:\Myfolder\myapplication.exe"
App=Shell(Myapp,3)

It worked fine with W98, but not with XP. XP seems not to know "Program~1"
for "program files" and to refuse the space if i use "Program Files"
--
_______________________________________

Site personnel : http://perso.wanadoo.fr/dimphoto
Nov 12 '05 #3

P: n/a
alain wrote:
Mike,
I proceeded so :
Dim Myapp as string
Dim App as variant
Myapp = "C:\Program~1\Access_2000\Office\Msaccess.exe
C:\Myfolder\myapplication.exe"
App=Shell(Myapp,3)

It worked fine with W98, but not with XP. XP seems not to know
"Program~1" for "program files" and to refuse the space if i use
"Program Files"


The filename would be "progra~1 ", 8 characters in MSDOS names :)

Add extra quotes... (I think you need extra quotes around each part, the
program and the command-line argument if they have any spaces in the
names)

eg..

Myapp = Chr(32) & "C:\Program~1\Access_2000\Office\Msaccess.exe" &
Chr(32) & " C:\Myfolder\myapplication.exe"

--
regards,

Bradley
Nov 12 '05 #4

P: n/a

You need to embed the quotes in the string, to do this you double them up

so either

MyApp = """C:\Program Files\Access_2000\Office\Msaccess.exe""" _
& " C:\Myfolder\myapplication.mdb"

App=Shell(Myapp,3)
or

const D_QUOTE = """"

MyApp = D_QUOTE & "C:\Program Files\Access_2000\Office\Msaccess.exe""" _
& D_QUOTE & " C:\Myfolder\myapplication.mdb"
App=Shell(Myapp,3)

Should do it
--
Terry Kreft
MVP Microsoft Access
"alain" <no*******@wanadoo.fr> wrote in message
news:c6**********@news-reader2.wanadoo.fr...
Mike,
I proceeded so :
Dim Myapp as string
Dim App as variant
Myapp = "C:\Program~1\Access_2000\Office\Msaccess.exe
C:\Myfolder\myapplication.exe"
App=Shell(Myapp,3)

It worked fine with W98, but not with XP. XP seems not to know "Program~1"
for "program files" and to refuse the space if i use "Program Files"
--
_______________________________________

Site personnel : http://perso.wanadoo.fr/dimphoto

Nov 12 '05 #5

P: n/a
I wil try; Thank you to all.

Alan

--
_______________________________________

Site personnel : http://perso.wanadoo.fr/dimphoto
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.