By default, the current directory for your Windows service is the System32 folder.  When you try to access a file or folder using a relative path it will throw you off. Use the following code in your C# application and you are all set


Similarly if you run a batch script as an administrator it defaults to System32 folder as home directory. Add the following lines in your batch script to set the execution directory as current directory.

@setlocal enableextensions
@cd /d "%~dp0"