473,408 Members | 1,739 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,408 software developers and data experts.

Process.Start( ) syntax

mg
The Process.Start( ) method below works correctly.

System.Diagnostics.Process.Start("c:\\program files\\adobe\\acrobat
6.0\\reader\\acrord32.exe",@"/t ""c:\exportfiles\d.pdf"" ""HP LaserJet 3300
Series PCL 6"" ""HP LaserJet 3300 Series PCL 6"" ""DOT4_001""");

I need to substitute a variable str1 for c:\exportfiles\d.pdf
programatically.

For example, String str1 = "c:\exportfiles\x.pdf";

I haven't been a to do so and would appreciate your help in doing so.
Nov 16 '05 #1
3 3146
mg,

When you use this:

String str1 = "c:\exportfiles\x.pdf";

It is trying to escape the \e and the \x. You can do one of two things,
doubling up the slashes, or using the @ literal identifier:

// Identical.
String str1 = "c:\\exportfiles\\x.pdf";
String str2 = @"c:\exportfiles\x.pdf";

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

"mg" <mg@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
The Process.Start( ) method below works correctly.

System.Diagnostics.Process.Start("c:\\program files\\adobe\\acrobat
6.0\\reader\\acrord32.exe",@"/t ""c:\exportfiles\d.pdf"" ""HP LaserJet
3300
Series PCL 6"" ""HP LaserJet 3300 Series PCL 6"" ""DOT4_001""");

I need to substitute a variable str1 for c:\exportfiles\d.pdf
programatically.

For example, String str1 = "c:\exportfiles\x.pdf";

I haven't been a to do so and would appreciate your help in doing so.

Nov 16 '05 #2
mg
I tried

String str = "c:\\exportfiles\\d.pdf";

System.Diagnostics.Process.Start("c:\\program files\\adobe\\acrobat
6.0\\reader\\acrord32.exe",@"/t " + str + " ""HP LaserJet 3300 Series PCL 6""
""HP LaserJet 3300 Series PCL 6"" ""DOT4_001""");

But, this isn't correct (produces many syntax errors). What can I do?

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

When you use this:

String str1 = "c:\exportfiles\x.pdf";

It is trying to escape the \e and the \x. You can do one of two things,
doubling up the slashes, or using the @ literal identifier:

// Identical.
String str1 = "c:\\exportfiles\\x.pdf";
String str2 = @"c:\exportfiles\x.pdf";

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

"mg" <mg@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
The Process.Start( ) method below works correctly.

System.Diagnostics.Process.Start("c:\\program files\\adobe\\acrobat
6.0\\reader\\acrord32.exe",@"/t ""c:\exportfiles\d.pdf"" ""HP LaserJet
3300
Series PCL 6"" ""HP LaserJet 3300 Series PCL 6"" ""DOT4_001""");

I need to substitute a variable str1 for c:\exportfiles\d.pdf
programatically.

For example, String str1 = "c:\exportfiles\x.pdf";

I haven't been a to do so and would appreciate your help in doing so.


Nov 16 '05 #3
mg,

The string:

" ""HP LaserJet 3300 Series PCL 6"" ""HP LaserJet 3300 Series PCL 6""
""DOT4_001"""

Should be:

@" ""HP LaserJet 3300 Series PCL 6"" ""HP LaserJet 3300 Series PCL 6""
""DOT4_001"""
"mg" <mg@discussions.microsoft.com> wrote in message
news:72**********************************@microsof t.com...
I tried

String str = "c:\\exportfiles\\d.pdf";

System.Diagnostics.Process.Start("c:\\program files\\adobe\\acrobat
6.0\\reader\\acrord32.exe",@"/t " + str + " ""HP LaserJet 3300 Series PCL
6""
""HP LaserJet 3300 Series PCL 6"" ""DOT4_001""");

But, this isn't correct (produces many syntax errors). What can I do?

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

When you use this:

String str1 = "c:\exportfiles\x.pdf";

It is trying to escape the \e and the \x. You can do one of two
things,
doubling up the slashes, or using the @ literal identifier:

// Identical.
String str1 = "c:\\exportfiles\\x.pdf";
String str2 = @"c:\exportfiles\x.pdf";

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

"mg" <mg@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
> The Process.Start( ) method below works correctly.
>
> System.Diagnostics.Process.Start("c:\\program files\\adobe\\acrobat
> 6.0\\reader\\acrord32.exe",@"/t ""c:\exportfiles\d.pdf"" ""HP LaserJet
> 3300
> Series PCL 6"" ""HP LaserJet 3300 Series PCL 6"" ""DOT4_001""");
>
> I need to substitute a variable str1 for c:\exportfiles\d.pdf
> programatically.
>
> For example, String str1 = "c:\exportfiles\x.pdf";
>
> I haven't been a to do so and would appreciate your help in doing so.


Nov 16 '05 #4

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

Similar topics

177
by: C# Learner | last post by:
Why is C syntax so uneasy on the eye? In its day, was it _really_ designed by snobby programmers to scare away potential "n00bs"? If so, and after 50+ years of programming research, why are...
2
by: Greg Smith | last post by:
I am trying to use the "Ping" command and capture the output. I can run it with the following: System.Diagnostics.Process.Start("ping.exe","-a 123.123.123.123"); This works fine. However,...
5
by: mg | last post by:
The Process.Start( ) method below works correctly. System.Diagnostics.Process.Start("c:\\program files\\adobe\\acrobat 6.0\\reader\\acrord32.exe",@"/t ""c:\exportfiles\d.pdf"" ""HP LaserJet 3300...
6
by: danl | last post by:
I need to be able to execute a .bat file from a C# web application I have the following code that compliles and seems to run fine, but the bat file never does it's work...
2
by: mg | last post by:
c:\pdf\pdfmp3d.exe /c:\exportfiles /0 /0 /0 /0 runs correctly in the Command Prompt. But, not in the C# code behind of a WebForm: ...
17
by: asearle | last post by:
Hallo everyone, After playing around with 'fork' in order to try to get a one process to monitor another, I have changed my tack and switched to Win32::Process. Indeed, it looks like this...
1
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a C# application in which I start another process which produces output to stdout and stderr. In fact, that process is the uSoft VS2005 C/C++ compiler itself! I would like to...
4
by: =?Utf-8?B?YmlsbA==?= | last post by:
i'm using VS2005, VB.NET windows forms application when I try to open a web page using process.start, i get an error: "application not found" I'm using this syntax: ...
7
by: Kevin Vogler | last post by:
I'm trying to programatically run an app. The command line syntax is: "C:\Program Files\WinSCP3\WinSCP3.exe" -script=myscript.txt and it works as intended. In code, I have this Dim myProc As...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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
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...

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.