Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #1799

Re: Getting some system information via VBSCript

From "Mayayana" <mayayana@invalid.nospam>
Newsgroups comp.lang.basic.visual.misc
Subject Re: Getting some system information via VBSCript
Date 2013-07-10 08:53 -0400
Organization A noiseless patient Spider
Message-ID <krjl5e$4va$1@dont-email.me> (permalink)
References <8061win2ic.fsf@gmail.com>

Show all headers | View raw


  First, you're in the wrong group. This is VB.
VBScript is microsoft.public.scripting.vbscript

   If you want to check your "permissions" in
a folder it might be easiest to just try writing
a file and check for an access deined error. (I
don't remember the number offhand.) Folders
have read-only attribute. (As far as I know,
Microsoft has never offered a coherent reason
for that, but I think it's true from XP on.)

-- 
--
"Vincent "Belaïche"" <vincent.belaiche@gmail.com> wrote in message 
news:8061win2ic.fsf@gmail.com...
| Hello,
|
| I have written the following script
| '#######################################################################
| Dim oFSO
| Set oFSO = WScript.CreateObject("Scripting.FileSystemObject" )
|
| Const iIS_DIRECTORY = 16
| Const iIS_READ_ONLY = 1
|
| Function HasWriteAccess(sFolderName_IN) 'As String
|   Dim oFolder
|   Set oFolder = oFSO.GetFolder(sFolderName_IN)
|   Dim iAttr
|   iAttr = 0
|   On Error Resume Next
|   iAttr = oFolder.Attributes
|   Set oFolder = Nothing
|   If ((iAttr And 16 ) <> 0) And ((iAttr And 1 ) = 0) Then
|      HasWriteAccess = "true"
|   Else
|      HasWriteAccess = "false"
|   End If
| End Function
|
| Dim oWshShell, sPrograms, sWritablePrograms
| Set oWshShell = WScript.CreateObject("WScript.Shell" )
| sPrograms = oWshShell.SpecialFolders("Programs")
| sWritablePrograms = HasWriteAccess(sPrograms)
|
| WScript.Echo "Programs=" & sPrograms
| WScript.Echo "WritablePrograms=" & sWritablePrograms
| '######################################################################
|
| and when I run it the response is as follows:
| '######################################################################
| Microsoft (R) Windows Script Host Version 5.7
| Copyright (C) Microsoft Corporation 1996-2001. Tous droits réservés.
|
| Programs=C:\Documents and Settings\Vincent\Menu Démarrer\Programmes
| WritablePrograms=false
| '######################################################################
|
| Now, this answer seems wrong to me, because if I open some command line
| console and I do:
|
| Rem ###################################################################
| cd /D "C:\Documents and Settings\Vincent\Menu Démarrer\Programmes"
| mkdir toto
| Rem ###################################################################
|
| That will work without error, i.e. --- contrary to the script response I
| do have write access on special folder "Programs".
|
| Any help is welcome.
|
|    Vincent. 

Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Getting some system information via VBSCript vincent.belaiche@gmail.com (Vincent Belaïche) - 2013-07-10 12:16 +0200
  Re: Getting some system information via VBSCript "Mayayana" <mayayana@invalid.nospam> - 2013-07-10 08:53 -0400
    Re: Getting some system information via VBSCript vincent.belaiche@gmail.com (Vincent Belaïche) - 2013-07-10 22:46 +0200
      Re: Getting some system information via VBSCript "Mayayana" <mayayana@invalid.nospam> - 2013-07-10 19:06 -0400
        Re: Getting some system information via VBSCript "Theo Tress" <rbk@online.de> - 2013-08-14 15:21 +0200
          Re: Getting some system information via VBSCript "Mayayana" <mayayana@invalid.nospam> - 2013-08-14 10:16 -0400
            Re: Getting some system information via VBSCript Deanna Earley <dee.earley@icode.co.uk> - 2013-08-14 16:41 +0100
              Re: Getting some system information via VBSCript "Mayayana" <mayayana@invalid.nospam> - 2013-08-14 11:53 -0400
          Re: Getting some system information via VBSCript ralph <nt_consulting@yahoo.com> - 2013-08-14 11:23 -0500
  Re: Getting some system information via VBSCript Deanna Earley <dee.earley@icode.co.uk> - 2013-07-11 09:48 +0100
    Re: Getting some system information via VBSCript vincent.belaiche@gmail.com (Vincent Belaïche) - 2013-07-12 22:00 +0200

csiph-web