7 Replies - 380 Views - Last Post: 03 February 2018 - 09:07 PM

#1 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1460
  • View blog
  • Posts: 4,726
  • Joined: 20-March 10

Folder read only attribute preventing sql database being written to

Posted 03 February 2018 - 08:40 AM

So I have this small problem with a Lenovo ThinkPad Tab2 running windows 8.1 Pro 32 bit,

I am trying to install one of my Engineering programs onto it, its coming up with the error database is read only.

I have figured out that this is because of the folder in which it resides is read-only attribute set and I cant seem to remove it tried with attrib command from the cmd prompt.

As a work around I have installed the program on an sd card and this runs fine from the Tablet but soon as I put it in a folder same problem..

Is there a way to remove the read only folder attribute in windows 8.1 or not ?

I am currently thinking of writing a program with SHCreateDirectory and CopyFile2.

Is This A Good Question/Topic? 0
  • +

Replies To: Folder read only attribute preventing sql database being written to

#2 jimblumberg   User is online

  • member icon

Reputation: 5470
  • View blog
  • Posts: 17,023
  • Joined: 25-December 09

Re: Folder read only attribute preventing sql database being written to

Posted 03 February 2018 - 08:48 AM

What does your directory structure look like. Perhaps your marvelous OS is protecting you from yourself and you may need to install the program into some other base directory?
Was This Post Helpful? 0
  • +
  • -

#3 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1460
  • View blog
  • Posts: 4,726
  • Joined: 20-March 10

Re: Folder read only attribute preventing sql database being written to

Posted 03 February 2018 - 09:20 AM

It C:\Program Files\Receipt Maker

and yes as I say if i dont install on C: drive it works fine ie the sdcard is drive E:

but you would think it would let you install to program files..
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6166
  • View blog
  • Posts: 21,268
  • Joined: 05-May 12

Re: Folder read only attribute preventing sql database being written to

Posted 03 February 2018 - 09:46 AM

Yeah, "Program Files" has special protections. Not as tight as the "Windows" folder, but still relatively tight.

Installation programs call the Windows Setup APIs. The APIs offload to the Installation Service which is running with special privileges.

Best thing to do is to install into a different directory.
Was This Post Helpful? 0
  • +
  • -

#5 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1460
  • View blog
  • Posts: 4,726
  • Joined: 20-March 10

Re: Folder read only attribute preventing sql database being written to

Posted 03 February 2018 - 09:49 AM

Any way to overcome the problem either by registry or other means ?
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6166
  • View blog
  • Posts: 21,268
  • Joined: 05-May 12

Re: Folder read only attribute preventing sql database being written to

Posted 03 February 2018 - 10:41 AM

Cacls.exe

Very likely, you will have to run an administrator when you try to change the ACLs on "Program Files", and even that may not be enough. Running in Safe Mode may help a little bit while you try to change the ACLs, but still no guarantees.
Was This Post Helpful? 0
  • +
  • -

#7 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6166
  • View blog
  • Posts: 21,268
  • Joined: 05-May 12

Re: Folder read only attribute preventing sql database being written to

Posted 03 February 2018 - 12:17 PM

This will probably work in Win10:
Removing the security restrictions from a folder in the Program Files folder
Was This Post Helpful? 0
  • +
  • -

#8 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1460
  • View blog
  • Posts: 4,726
  • Joined: 20-March 10

Re: Folder read only attribute preventing sql database being written to

Posted 03 February 2018 - 09:07 PM

So i figured it out the solution was embarrassingly obvious,

put the database file in the hidden folder program data... i had completely forgotten about this windows new quirk the separation of program data and program files...

silly me..
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1