How to copy file with Administrator's right
Hello everybody ,
When I write VB6 program , I need to copy files to C:\Windows. But always fail as I don't have Administrator's Right. I found a program on web but also fail :
Option Explicit
Private Sub Command1_Click()
Const ssfDESKTOP = 0
Const ssfWINDOWS = 36
Dim OriginalFile As String
Dim CopiedFile As String
Dim F As Integer
With CreateObject("Shell.Application")
With .NameSpace(ssfDESKTOP).Self
OriginalFile = .Path & "\test-orig.txt"
End With
With .NameSpace(ssfWINDOWS).Self
CopiedFile = .Path & "\test-copy.txt"
End With
End With
F = FreeFile(0)
Open OriginalFile For Output As #F
Print #F, "Testing!"
Close #F
DoEvents
FileCopy OriginalFile, CopiedFile
Kill OriginalFile
MsgBox FileLen(CopiedFile)
End Sub
Please help me. Thanks a lot
Re: How to copy file with Administrator's right
Can't get around ADMINISTRATOR permissions, since Windows 95. Each version gets harder, and you didn't mention your OS.
Re: How to copy file with Administrator's right
Thanks Sir ,
I'm using Windows 7
Even when I install Adobe Photoshop 5.0 , still file and Adobe folder can be installed and copied in program files. Such an old software still can write stuffs in Program Files and some dll in C:\Windows\System32 , but why can we write files in C:\Windows via VB6 ?
Thanks for your tutorial.
Re: How to copy file with Administrator's right
Vb6 instalation RUN AS ADMINISTRATOR. Just right click on vb6.exe file, then choose (run as administrator)
All your programs run as administrator. Of course you just can change folders rights from admin to other.
Re: How to copy file with Administrator's right
Because it calls the TRUSTED INSTALLER Service. This is the ONLY way to install in a private Windows folder. You cannot write to some areas. Period.
Re: How to copy file with Administrator's right
Quote:
Originally Posted by
dglienna
You cannot write to some areas
He do not need to do this: write some area, just change settings of trusted instaler or do nothing and jus run programs as administrator.
Re: How to copy file with Administrator's right
Care to tell anyone HOW to "just change settings of trusted installer". Do nothing sounds better.
Re: How to copy file with Administrator's right
Quote:
Originally Posted by
dglienna
Care to tell anyone HOW to "just change settings of trusted installer". Do nothing sounds better.
I agree. Better not change settings if you dont know what to do. Just run soft as admin. Who wants to change settings of trusted installer can find info in internet. See in this video how to change settings and gain full control:
http://www.youtube.com/watch?v=y9TOWxZGbJc
Re: How to copy file with Administrator's right
Try that on any WINDOWS or PROGRAM folder and see what happens when you try to INSTALL ANOTHER APP. No way to reverse the process other than clean install.
Re: How to copy file with Administrator's right
I think you should look up 'Elevated Rights'.... (this essentially, Asks the Windows UAC for permition, and the UAC will grant according to settings and user response...
Re: How to copy file with Administrator's right
Hi! As one of the options I can advise to use virtualization. For example, it can be boxedapp or thinapp.