I have a simple console project that I want to pass 2 arguments into. Here is a simple example of the code that I have.
static void Main(string[] args);
{
string somevar = args[0];
string somevar2 = args[1];
doSomething (somevar, somevar2);
}
I want to run the program like this.
C:\testapp.exe "C:\documents and settings\administrator\application data\testapp\" "C:\documents and settings\administrator\application data\testapp\toBeUploaded.zip"
I tried it with and without the quotation marks but it appears that the program is only getting C:\documents for the first string and "and" for the second string. How do I get arount this

simple console question
saaniok
You could try using the old MS-DOS name (8.3 format) for the folder, which would probably be:
C:\DOCUME~1\ADMINI~1\APPLIC~1\TESTAPP
I'm guessing that you should also get rid of the quotes since they are showing up inside the string arguement.
If you ever want to find out the 8.3 format name for a folder or file again, use the command prompt and go to the directory it is contained in. Then type dir /x and you'll see the 8.3 name (if it has one) in the second last column.
Hope that helps.
Lim Tee Loong
frieste
C:\testapp.exe "C:\documents and settings\administrator\application data\testapp" "C:\documents and settings\administrator\application data\testapp\toBeUploaded.zip"
or
C:\testapp.exe "C:\documents and settings\administrator\application data\testapp\\" "C:\documents and settings\administrator\application data\testapp\toBeUploaded.zip"
sagebrushsag
glenhoo
I tried that already it didn't change anything. I still am getting cut off because of the command prompt all my program is getting is
args[0] is "C:\documents and settings\administrator\application data\testapp"
args[1] is "C:\documents
args[2] is and
args[3] is settings\admin
so it's just not getting eveything. if you notice it cuts off inside second string. it's too long and because the second " is not included in the input ot the program it breaks the strings down into multiple string because of the spaces. Is there another way to read data into the file or am I going to have to create a file with the two paths in it and the program will just read the file
SarasMax
budbjames
That didn't seem to change anything. I am running this from a command prompt and for some reason your reply made me wonder if maybe the string is too long for dos. Do you know how many characters you can have in a dos command
wpf michelle
Hello All.
mattdawg:
If you don't want to listen to the answer, then why ask the question What is happening is that the ending '\' is resulting in the beginning and ending quotes being included in the first command line parameter, instead of delineating it. Add a second '\' to it, and it will behave the way you want it to. Brendan and boban.s are correct. You should listen to them.
HTH.