0

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

SteveAnselment
  • 634
  • 3
  • 10
  • 29

1 Answers1

0

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.

John Lockwood
  • 3,787
  • 29
  • 27
  • I have decided to go with using a Batch file to copy the .exe and its .config file to the Program Files and second copy of the .exe to the start-up folder. The exe will point to the program files folder for its config file. The exe is really small only a couple of kb so I'm not concerned about redundant files taking space on the Hard drive. If anyone knows a way to not have the .exe in 2 locations and still be able to point to the config in a different location that would be a great help and allow me to do this more efficiently. – SteveAnselment Jul 11 '13 at 14:47