Search code examples
c#-4.0batch-fileconsole-applicationapp-configstartup-folder

Issue with App.Config in the Startup Folder


I am writing a console app in c#.net. I have a batch file that currently copies the exe and exe.config to the startup folder on local machine from the network. It is set up that way so the user only has to run the batch file and then everytime the computer is started the exe will run.

Problem I am running into is that it also opens (or tries to open) the exe.config file as well. I am looking for the best workaround for this without it being overly complicated. Thought about putting the config file in a diferent location and then hardcoding the new location into the configuration manager but one of the concepts with the config file is to keep all hardcoded paths out of the code for easier updates if locations change. Also thought about putting a shortcut to the exe in the startup folder which would work but I want it to be transparant to the user. In other words all I want the user to do is run the .bat file once and forget about it.

Any help or ideas would be greatly appreciated as I am very new to .bat files


Solution

  • I like your idea of a shortcut, or for that matter a batch file pointing to the executable, with both the executable and config file located outside the startup folder.