Jump to content

Create a file when running as a service


wsv01

Recommended Posts

I have an application running as a service. The service properties are set to log on as the local system account. I have a test set up to try and create a file in the files folder.

Here is my code using a TuniDBMemo object.

memo.Lines.Clear;
memo.Lines.Add('hello');
memo.Lines.SaveToFile(UniServerModule.FilesFolder + 'MyFile.txt');
 

When I run the application, I receive this error. Why is it trying to create the file in a files folder below the system32 folder?

"C:\Windows\system32\files\MyFile.txt".

Link to comment
Share on other sites

Thanks for the info. I tried that.

I did figure it out. I ended up using something like this.

memo.Lines.Clear;
memo.Lines.Add('hello');
memo.Lines.SaveToFile(UniServerModule.ServerRoot + 'files\MyFile.txt');

I was able to use the local system account and get everything to work.

I'm not sure this is the perfect answer, but it works for my needs.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...