title: Storing File Path as variable for C# Console Application
body: <p>I'm trying to create a C# console application that will generate a log file. I'd like to have some flexibility with where the log file will be stored. </p>
  
  <p>I tried using the Settings.settings file with:</p>
  
  <p>Name: logDrive
  Type: string
  Scope: Application
  Value: C:\Scripts\Logs</p>
  
  <p>In my code, I'm using:</p>
  
  <pre><code>string logFile = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
  logFile = logFile.Replace(@"/", @"-").Replace(@"\", @"-") + ".log";
  string logDrive = Properties.Settings.Default.logDrive;
  StreamWriter output = new StreamWriter(logDrive + logFile);
  </code></pre>
  
  <p>When compiling the above I get the error message "The given path's format is not support."</p>
  
  <p>If it helps, the values for:</p>
  
  <p>logDrive = "C:\Scripts\ServiceDesk\Logs"
  logFile = "3-23-2009 1:20 PM.log"</p>
  
  <p>Does anyone have any thoughts/ recommendations for a better approach and/ or what I'm doing wrong?</p>