473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Command Line Arguments

Is it possible to get the full command line argument string that was used to
launch your current process other than using the args[]. I would like to see
the original string before the args are interpreted.

Thanks.
Nov 17 '05 #1
8 3154
System.Environment.CommandLine
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Brian Scott" <Br***@MosaicSoftware.co.uk> wrote in message
news:d3*******************@news.demon.co.uk...
Is it possible to get the full command line argument string that was used
to
launch your current process other than using the args[]. I would like to
see
the original string before the args are interpreted.

Thanks.

Nov 17 '05 #2
the Environment.CommandLine property.

"Brian Scott" <Br***@MosaicSoftware.co.uk> wrote in message
news:d3*******************@news.demon.co.uk...
Is it possible to get the full command line argument string that was used to launch your current process other than using the args[]. I would like to see the original string before the args are interpreted.

Thanks.

Nov 17 '05 #3
Cheers, that helped.

"James Curran" <ja*********@mvps.org> wrote in message
news:e7*************@TK2MSFTNGP15.phx.gbl...
the Environment.CommandLine property.

"Brian Scott" <Br***@MosaicSoftware.co.uk> wrote in message
news:d3*******************@news.demon.co.uk...
Is it possible to get the full command line argument string that was
used to
launch your current process other than using the args[]. I would like to

see
the original string before the args are interpreted.

Thanks.


Nov 17 '05 #4
string arguments = String.Join(" ", args);

Nov 17 '05 #5
Frisco,

That is what i was using prior but using the Environment variable seems
better as we can also see the execution path. I was trying to debug invalid
user enterred arguments.

Thanks

"FriscoSoxFan" <ju**@kreusch.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
string arguments = String.Join(" ", args);

Nov 17 '05 #6
You cant however rely on that the execution path is in that string.

The user might have changed directory prior to start your application:
cd c:\dev
YourApp "An Argument"
or he might not:
c:\dev\YourApp.exe "An Argument"

but you are probably aware of that already.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Brian Scott" <Br***@MosaicSoftware.co.uk> wrote in message
news:d3*******************@news.demon.co.uk...
Frisco,

That is what i was using prior but using the Environment variable seems
better as we can also see the execution path. I was trying to debug
invalid
user enterred arguments.

Thanks

"FriscoSoxFan" <ju**@kreusch.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
string arguments = String.Join(" ", args);


Nov 17 '05 #7
No I wasn't aware, thanks for pointing that out.
"Dennis Myrén" <de****@oslokb.no> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
You cant however rely on that the execution path is in that string.

The user might have changed directory prior to start your application:
cd c:\dev
YourApp "An Argument"
or he might not:
c:\dev\YourApp.exe "An Argument"

but you are probably aware of that already.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Brian Scott" <Br***@MosaicSoftware.co.uk> wrote in message
news:d3*******************@news.demon.co.uk...
Frisco,

That is what i was using prior but using the Environment variable seems
better as we can also see the execution path. I was trying to debug
invalid
user enterred arguments.

Thanks

"FriscoSoxFan" <ju**@kreusch.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
string arguments = String.Join(" ", args);



Nov 17 '05 #8
If you want the path to your application at runtime, you can do:
string fullPath =
System.Reflection.Assembly.GetExecutingAssembly(). Location;

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Brian Scott" <Br***@MosaicSoftware.co.uk> wrote in message
news:d3*******************@news.demon.co.uk...
No I wasn't aware, thanks for pointing that out.
"Dennis Myrén" <de****@oslokb.no> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
You cant however rely on that the execution path is in that string.

The user might have changed directory prior to start your application:
cd c:\dev
YourApp "An Argument"
or he might not:
c:\dev\YourApp.exe "An Argument"

but you are probably aware of that already.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Brian Scott" <Br***@MosaicSoftware.co.uk> wrote in message
news:d3*******************@news.demon.co.uk...
> Frisco,
>
> That is what i was using prior but using the Environment variable seems
> better as we can also see the execution path. I was trying to debug
> invalid
> user enterred arguments.
>
> Thanks
>
> "FriscoSoxFan" <ju**@kreusch.com> wrote in message
> news:11**********************@g14g2000cwa.googlegr oups.com...
>> string arguments = String.Join(" ", args);
>>
>
>



Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hari | last post by:
can i have command line arguments in VS.NET applicatio? if yes how? Can i have some code snippets of the above functionality? I know we can acjieve this in console application form command...
6
by: Jon Hewer | last post by:
hi i am writing a little script and currently implementing command line arguments following the guide by mark pilgrim from dive into python; ...
7
by: Steve M | last post by:
I'm trying to invoke a Java command-line program from my Python program on Windows XP. I cannot get the paths in one of the arguments to work right. The instructions for the program describe the...
2
by: SunRise | last post by:
Hi I am creating a C Program , to extract only-Printable-characters from a file ( any type of file) and display them. OS: Windows-XP Ple help me to fix the Errors & Warnings and explain...
1
by: amirmira | last post by:
I would like to set command line arguments to a service at install time. I need to do this because I need to get information from different registry locations depending on my command line argument....
1
by: Rune Jacobsen | last post by:
Hi, I've been trying to figure this one out, but my experience just doesn't have what it takes... :| I am writing an application that reads an XML file and displays the contents in various...
4
by: Roland | last post by:
Hi, I am developing a C++ project and want to pass some command line arguments in VS .NET 2003. I am in debug mode, the configuration is set to Debug and I entered my argument list in Project ->...
40
by: raphfrk | last post by:
I have a program which reads in 3 filenames from the command line prog filename1 filename2 filename3 However, it doesn't work when one of the filenames has spaces in it (due to a directory...
2
by: Milan | last post by:
Hi, Please guide me how to set command line argument and how to retrive command line argument. Senario: vb.net application should be able to execute from command prompt by passing login and...
7
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.