Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. WIN directory to DOS directory question

WIN directory to DOS directory question

Scheduled Pinned Locked Moved C#
question
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Goobashi
    wrote on last edited by
    #1

    Is there a super easy way to convert a string generated from something like Application.StartupPath to dos compatibility (i.e. directories with spaces have quotes around them and Directories that are too long have a ~ inserted? Thanks, Colin

    M M 0 3 Replies Last reply
    0
    • G Goobashi

      Is there a super easy way to convert a string generated from something like Application.StartupPath to dos compatibility (i.e. directories with spaces have quotes around them and Directories that are too long have a ~ inserted? Thanks, Colin

      M Offline
      M Offline
      musefan
      wrote on last edited by
      #2

      yeah, you format the string yourself, how much easier can you get? (without doing any work that is)

      Life goes very fast. Tomorrow, today is already yesterday.

      G 1 Reply Last reply
      0
      • M musefan

        yeah, you format the string yourself, how much easier can you get? (without doing any work that is)

        Life goes very fast. Tomorrow, today is already yesterday.

        G Offline
        G Offline
        Goobashi
        wrote on last edited by
        #3

        I figured as much, just wanted to make sure I wasn't missing somethign horribly obvious like toString.DosCompatability :) or something dumb like that :)

        1 Reply Last reply
        0
        • G Goobashi

          Is there a super easy way to convert a string generated from something like Application.StartupPath to dos compatibility (i.e. directories with spaces have quotes around them and Directories that are too long have a ~ inserted? Thanks, Colin

          M Offline
          M Offline
          Matjaz xyz
          wrote on last edited by
          #4

          Try this:

          Path.GetTempFileName();
          Path.GetTempPath();

          I think you'll manage implanting this one :)

          Regards, Matjaž

          1 Reply Last reply
          0
          • G Goobashi

            Is there a super easy way to convert a string generated from something like Application.StartupPath to dos compatibility (i.e. directories with spaces have quotes around them and Directories that are too long have a ~ inserted? Thanks, Colin

            0 Offline
            0 Offline
            0x3c0
            wrote on last edited by
            #5

            Try using the GetShortPathName API. You can get the function signature at pinvoke.net, and an example here

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups