I have a console file, which takes 6 arguments
I pass this argument using C# application, below code
try
{
intializeConnections();
string consolepath = System.Configuration.ConfigurationManager.AppSettings["ConsoleApp_backup"].ToString().Trim();
// string backupPath = System.Configuration.ConfigurationManager.AppSettings["DataBase_BackupPath"].ToString().Trim();
string backupPath = @"D:\backup\Smart Tracker\";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = consolepath;
// proc.StartInfo.Arguments = String.Format(consolepath, Pc, database, UserName, Password, "F", bacPath);
proc.StartInfo.Arguments = String.Format("{0} {1} {2} {3} {4} {5}", serverName, DatabaseName, UserId, pw, "F",backupPath );
//set the rest of the process settings
proc.Start();
clsGlobleFunction.InsertAuditTrailRecord_new(this.Name, "", "", "FullBackup Of Databse Done Sucessfull", clsGlobleFunction.ActiveUser);
MessageBox.Show("FullBackup Done Successfully!!!!");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "Give Correct Path in input !!");
}
Its work perfectly, but whenever i pass argument which have space in it, like in this code in backup Folder path, i am passing folder path string backupPath = @"D:\backup\Smart Tracker\"
so, its not working, console application consider space as a ending of argument,
and showing this error..
so, how can i pass argument which have space!!!!