Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set file Permissions 1

Status
Not open for further replies.

bigdavelamb

Programmer
Jun 11, 2003
97
0
0
GB
Hi, hope someone can help, I would like to change permissions on a folder and wondered if it is possible in vbscript, the reason being we have created an install for a asp.net web application a folder needs asp.net write priviliges and we can kickoff script as part of install. Cannot seem to find away to do it. Anyone know?

Thanks alot.

dave
 
you could shell out to a command prompt and use attrib
 
better yet you can batch file like so
+ - your atrtib [drive:][path][filename]
 
Hi, I don't think this is enough, as I need to give a specific user write access, the ASP.NET user specifically, the atrib as far as I am aware just sets read/write permissions on folder?

Thanks

dave
 
use xcacls I think it's in the NT Tool Kit to set perms, shell out to a command to use it form your VB.
 
Constant Value Description
Normal = 0 Normal file. No attributes are set.
ReadOnly = 1 Read-only file. Attribute is read/write.
Hidden = 2 Hidden file. Attribute is read/write.
System = 4 System file. Attribute is read/write.
Volume = 8 Disk drive volume label. Attribute is read-only.
Directory = 16 Folder or directory. Attribute is read-only.
Archive = 32 File has changed since last backup. Attribute is read/write.
Alias = 64 Link or shortcut. Attribute is read-only. Compressed = 128 Compressed file. Attribute is read-only.
(FileSpec="path")
in code
dim fldr, fso
set fso = CreateObject("Scripting.FileSystemObject")
set fldr = fso.Getfolder("FileSpec")
If f.attributes and 32 Then
f.attributes = f.attributes - 32
WScript.Echo("Archive bit cleared")
Else
f.attributes = f.attributes + 32
WScript.Echo("Archive bit is set")
End If
OR

put xcalcs in \winnt;\windows;or \windows\System32 or in your path some where :) ? = your specific commands
KeyBoardKey What you write
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
CTL ^
ALT %
shift $
dim WshShell
WshShell.run("xcalcs")
WScript.Sleep 500
WshShell.AppActivate("xcalcs.exe")
WshShell.SendKeys("?")
WScript.Sleep 100
WshShell.SendKey("?")
WScript.Sleep 100
ect
 
oops, mistake in shift
shift = +
and if you didn't know commands such as ^c (copy) ^v (paste) %{F4}(close) shortcut all work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top