I am creating a file:
String strPath = Application.StartupPath;
....
string filePath = strPath + "\\Books" + ".zpl";
later on the path is send to command line to be copied to parrallel port (for printing..)
string command = "copy " + filePath + " lpt1"; //prepare a string with the command to be sent to the printer
// The /c tells cmd that we want it to execute the command that follows, and then exit.
System.Diagnostics.ProcessStartInfo sinf = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
sinf.UseShellExecute = false;
sinf.CreateNoWindow = true;
System.Diagnostics.Process p = new System.Diagnostics.Process(); // new process
p.StartInfo = sinf;//load start info into process.
p.Start();
My problem is that Application.StartupPath
may contain folder names with spaces (like e.g: Document and Settings).
In that case I have to put quotes on that folder names.
However Application.StartupPath
=> the address path resulting will be known after the installation of the program in the client, so I don't if and how many folder names need quoting
Any ideas?