473,498 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do capture double quotes on commandline?

Hi,

Newbie here. Here's my code for a c# console app:

public static int Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Please enter a database name.");
return 1;
}
Console.WriteLine (@args[0]);
Find t = new Find();
t.DatabaseName = @args[0];
t.Search();
return 0;
}

If I use "master" has a parameter, what gets printed to the commandline is
master. I want to print "master". Why are the double-quotes getting lost? I
also want to set the t object's DatabaseName property to include the
double-quotes, but it's losing them too.

What am I missing? Thanks.

Nov 16 '05 #1
5 4375
Mark,

The command shell strips the quotes, as they are used to indicate
parameters that have spaces in them. You might want to try using quotes in
the quotes, like this (I'm not sure if this will work):

""master""

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"mark" <ma**@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com...
Hi,

Newbie here. Here's my code for a c# console app:

public static int Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Please enter a database name.");
return 1;
}
Console.WriteLine (@args[0]);
Find t = new Find();
t.DatabaseName = @args[0];
t.Search();
return 0;
}

If I use "master" has a parameter, what gets printed to the commandline is
master. I want to print "master". Why are the double-quotes getting lost?
I
also want to set the t object's DatabaseName property to include the
double-quotes, but it's losing them too.

What am I missing? Thanks.

Nov 16 '05 #2
hi,

You could try using "\"Master\"". I have used this before just check if it
works for you.

Tarakeshwar

"mark" <ma**@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com...
Hi,

Newbie here. Here's my code for a c# console app:

public static int Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Please enter a database name.");
return 1;
}
Console.WriteLine (@args[0]);
Find t = new Find();
t.DatabaseName = @args[0];
t.Search();
return 0;
}

If I use "master" has a parameter, what gets printed to the commandline is
master. I want to print "master". Why are the double-quotes getting lost? I also want to set the t object's DatabaseName property to include the
double-quotes, but it's losing them too.

What am I missing? Thanks.

Nov 16 '05 #3
Hi mark:

You can escape the double quotes with a backslash to prevent the
command shell from interpreting them before executing your program.

\"master\"

--
Scott
http://www.OdeToCode.com

On Thu, 16 Sep 2004 07:45:02 -0700, "mark"
<ma**@discussions.microsoft.com> wrote:
Hi,

Newbie here. Here's my code for a c# console app:

public static int Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Please enter a database name.");
return 1;
}
Console.WriteLine (@args[0]);
Find t = new Find();
t.DatabaseName = @args[0];
t.Search();
return 0;
}

If I use "master" has a parameter, what gets printed to the commandline is
master. I want to print "master". Why are the double-quotes getting lost? I
also want to set the t object's DatabaseName property to include the
double-quotes, but it's losing them too.

What am I missing? Thanks.


Nov 16 '05 #4
Yes; you may escape the quote by prefixing it with backslash, like:
"\"master\""

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"mark" <ma**@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
Thanks for the reply. ""master"" doesn't work either, the output is master. Any other ideas?

"Nicholas Paldino [.NET/C# MVP]" wrote:
Mark,

The command shell strips the quotes, as they are used to indicate
parameters that have spaces in them. You might want to try using quotes in the quotes, like this (I'm not sure if this will work):

""master""

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"mark" <ma**@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com...
Hi,

Newbie here. Here's my code for a c# console app:

public static int Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Please enter a database name.");
return 1;
}
Console.WriteLine (@args[0]);
Find t = new Find();
t.DatabaseName = @args[0];
t.Search();
return 0;
}

If I use "master" has a parameter, what gets printed to the commandline is master. I want to print "master". Why are the double-quotes getting lost? I
also want to set the t object's DatabaseName property to include the
double-quotes, but it's losing them too.

What am I missing? Thanks.


Nov 16 '05 #5
Thanks for the reply. ""master"" doesn't work either, the output is master.
Any other ideas?

"Nicholas Paldino [.NET/C# MVP]" wrote:
Mark,

The command shell strips the quotes, as they are used to indicate
parameters that have spaces in them. You might want to try using quotes in
the quotes, like this (I'm not sure if this will work):

""master""

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"mark" <ma**@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com...
Hi,

Newbie here. Here's my code for a c# console app:

public static int Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Please enter a database name.");
return 1;
}
Console.WriteLine (@args[0]);
Find t = new Find();
t.DatabaseName = @args[0];
t.Search();
return 0;
}

If I use "master" has a parameter, what gets printed to the commandline is
master. I want to print "master". Why are the double-quotes getting lost?
I
also want to set the t object's DatabaseName property to include the
double-quotes, but it's losing them too.

What am I missing? Thanks.


Nov 16 '05 #6

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

Similar topics

24
22554
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
4
13287
by: (PeteCresswell) | last post by:
Is his just a flat-out "No-No" or is there some workaround when it comes time for SQL searches and DAO.FindFirsts against fields containing same? I can see maybe wrapping the value searched for...
7
20872
by: gar | last post by:
Hi, I need to replace all the double quotes (") in a textbox with single quotes ('). I used this code text= Replace(text, """", "'" This works fine (for normal double quotes).The problem...
0
3464
by: j101 | last post by:
I am attempting to set up Q Capture on RH Linux (x86_64) using DB2 9 fp2, but there seems to be a general problem loading a specify MQ shared library "/opt/mqm/lib/libmqm_r.so". I have MQ v6...
0
7121
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6993
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
7162
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6881
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
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4899
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...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.