Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing path as argument to EXE
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01409769
Message ID:
01409787
Vues:
56
This message has been marked as the solution to the initial question of the thread.

>I am passing a file path as an argument to an EXE. All works well on my development machine because the path does not contain any spaces.
>So I am passing the following path:
>

>C:\Program Files\Alliance Laundry Systems\Quantum Coin Software\
>

>
>Now when I look at the args array it looks like this:
>

>C:\Program
>Files\Alliance
>Laundry
>Systems\Quantum
>Coin
>Software\
>

>
>I know I can put it back togeter into the correct path but I've got other stuff in the args and the order of the args elements is important (backwards compatibility and that stuff).
>
>Is there a way to pass a string into the args without it breaking it up in the args?
>
>Maybe if I use single quotes around it?
>
>Thanks,
>Einar

>>>Yes, you would need quotes around the path and I think single quotes would work OK.

Yes, Just you need to keep it in DOUBLE quotes,
You can test it with a simple console app:
        static void Main(string[] args)
        {
            for (int i = 0; i < args.Length; i++)
                Console.WriteLine(args[i]);
            Console.ReadLine();
        }
Then add a command line argument:
Select "properties" by right click on your project name then Enter the argument
to test in "Command line argument" of "Start Options" in "Debug" tab page

The argument can be: "This is a test"

HTH
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform