Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9082615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:36:05+00:00 2026-06-16T20:36:05+00:00

I have problem with printing *.prn file. This is code: Process process1 = new

  • 0

I have problem with printing *.prn file. This is code:

Process process1 = new Process();
process1.StartInfo.FileName = "copy";
process1.StartInfo.Arguments = string.Format(@" /b C:/test/test.prn \\127.0.0.1\{0}",
                                                         SelectPrinterForm.selectedLine);
process1.Start();

in SelectPrinterForm.selectedLine I have name of choosen printer. I’ve got error on Start() method with information cannot find file.

Edit (added stack trace):

w System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
w System.Diagnostics.Process.Start()

Questions:

Any suggestion why I’ve got this error?
Also why when I use “@” I still have "\\\\" instead of "\\" ?

Solution with help Hans Passant and his answer above

Process process1 = new Process();
string computerFullName = Program.GetFQDN();
process1.StartInfo.FileName = "cmd.exe";
process1.StartInfo.Arguments = string.Format(@" /c copy /B C:\test\test.prn \\{0}\{1}",
                                                     computerFullName,
                                                     SelectPrinterForm.selectedLine);
process1.Start();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:36:06+00:00Added an answer on June 16, 2026 at 8:36 pm

    Any suggestion why I’ve got this error?

    “copy” is not an executable file in Windows, it is a command for the command interpreter, cmd.exe. The equivalent would be Filename = “cmd.exe”, Arguments = “/c copy ” + string.Format(…). You probably won’t be pleased with the command window or the lousy error reporting that produces, consider File.Copy() instead.

    Also why when I use “@” I still have “\\” instead of “\” ?

    That’s a debugger artifact, it does not know whether or not you used @ in your code so errs on the safe side and displays the string as a regular C# string literal. Use the text visualizer to see the string as-is, click the spyglass icon.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with Python threading and sending a string in the arguments.
I have little problem with printing data like this, I have written script like
I have a problem that I am facing OuOfMemory Error while printing a string
I have a problem with printing PDF file from a Java project that is
I have problem with my query on C, I’m using the oci8 driver. This
I have problem with TableView its empty. In (.h) file: @interface TableViewController : UITableViewController{
i have problem with printing the array after reading it. After printing, the address
I have problem with variable printing inside javascript. variable htmlString printing not working: document.write(htmlString)
I am new to Perl and I have a problem that's very simple but
I have no problem printing an Express shipping label. The ground shipping label doesn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.