Space in file name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • alain

    Space in file name

    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


  • Mike Preston

    #2
    Re: Space in file name

    On Tue, 20 Apr 2004 09:17:27 +0200, "alain" <noaddress@wana doo.fr>
    wrote:
    [color=blue]
    >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.[/color]

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

    mike

    Comment

    • alain

      #3
      Re: Space in file name

      Mike,
      I proceeded so :
      Dim Myapp as string
      Dim App as variant
      Myapp = "C:\Program~1\A ccess_2000\Offi ce\Msaccess.exe
      C:\Myfolder\mya pplication.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


      Comment

      • Bradley

        #4
        Re: Space in file name

        alain wrote:[color=blue]
        > Mike,
        > I proceeded so :
        > Dim Myapp as string
        > Dim App as variant
        > Myapp = "C:\Program~1\A ccess_2000\Offi ce\Msaccess.exe
        > C:\Myfolder\mya pplication.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"[/color]

        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\A ccess_2000\Offi ce\Msaccess.exe " &
        Chr(32) & " C:\Myfolder\mya pplication.exe"

        --
        regards,

        Bradley


        Comment

        • Terry Kreft

          #5
          Re: Space in file name


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

          so either

          MyApp = """C:\Progr am Files\Access_20 00\Office\Msacc ess.exe""" _
          & " C:\Myfolder\mya pplication.mdb"

          App=Shell(Myapp ,3)


          or

          const D_QUOTE = """"

          MyApp = D_QUOTE & "C:\Program Files\Access_20 00\Office\Msacc ess.exe""" _
          & D_QUOTE & " C:\Myfolder\mya pplication.mdb"
          App=Shell(Myapp ,3)

          Should do it


          --
          Terry Kreft
          MVP Microsoft Access


          "alain" <noaddress@wana doo.fr> wrote in message
          news:c62qde$8mu $1@news-reader2.wanadoo .fr...[color=blue]
          > Mike,
          > I proceeded so :
          > Dim Myapp as string
          > Dim App as variant
          > Myapp = "C:\Program~1\A ccess_2000\Offi ce\Msaccess.exe
          > C:\Myfolder\mya pplication.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
          >
          >[/color]


          Comment

          • alain

            #6
            Re: Space in file name

            I wil try; Thank you to all.

            Alan

            --
            _______________ _______________ _________

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


            Comment

            Working...