When I run the console .net application from the bat file, for example. start myapp.exe
myapp.exe then tries to write the file to its current directory, although I get a .net error stating that the file is being used by another application (nothing else works)
http://i.stack.imgur.com/XLmnR.png
Although I run it, usually without a batch file, for example. double click on it, it works fine and displays the file in order. I thought this might be due to privileges, although I tried to run the batch file as an administrator, and I got the same error "The file is in use ..."
Can anyone shed some light on this?
code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace FileSearcher { class Program { static void Main(string[] args) { string dirPath = "C:\\"; FileSystemWatcher fileWatcher = new FileSystemWatcher(dirPath); fileWatcher.IncludeSubdirectories = true; fileWatcher.Filter = "*.exe";
source share