Sign in to follow this  
Followers 0
myspacee

Share local folder

3 posts in this topic

Hello to all,

I need to share [everyone] my local folder (eg: c:\sharemeplease\ )

Is possibile using native AI function ?

Thank you for help,

m.

Share this post


Link to post
Share on other sites



only way i found is create vbs and the run it

if FileExists(@ScriptDir & "\uti\share_local_folder.vbs") then FileDelete(@ScriptDir & "\uti\share_local_folder.vbs")
        
    local $file_vbs_share

    $file_vbs_share = FileOpen(@ScriptDir & "\uti\share_local_folder.vbs", 2)

; Check if file opened for writing OK
    If $file_vbs_share = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
;///////////////////////////////////// create SHARE for local dir
    FileWrite($file_vbs_share, "Const FILE_SHARE = 0" & @CRLF)
    FileWrite($file_vbs_share, "Const MAXIMUM_CONNECTIONS = 25" & @CRLF)
    FileWrite($file_vbs_share, "strComputer = " & chr(34) & "." & chr(34) & "" & @CRLF)
    FileWrite($file_vbs_share, "Set objWMIService = GetObject(" & chr(34) & "winmgmts:" & chr(34) & " & " & chr(34) & "{impersonationLevel=impersonate}!\\" & chr(34) & " & strComputer & " & chr(34) & "\root\cimv2" & chr(34) & ")" & @CRLF)
    FileWrite($file_vbs_share, "Set objNewShare = objWMIService.Get(" & chr(34) & "Win32_Share" & chr(34) & ")" & @CRLF)
    FileWrite($file_vbs_share, "errReturn = objNewShare.Create _" & @CRLF)
    FileWrite($file_vbs_share, "(" & chr(34) & @ScriptDir & chr(34) & ", " & chr(34) & "sharefon" & chr(34) & ", FILE_SHARE, _" & @CRLF)
    FileWrite($file_vbs_share, "MAXIMUM_CONNECTIONS, " & chr(34) & "Repository for Fonera capture" & chr(34) & ")" & @CRLF)


    FileClose($file_vbs_share)

Any other way ?

m.

Share this post


Link to post
Share on other sites

@myspacee

maybe this can get you going

Const $FILE_SHARE = 0
Const $MAXIMUM_CONNECTIONS = 25

$strComputer = "."
$objWMIService = ObjGet ("winmgmts:\\" & $strComputer & "\root\cimv2")

$objNewShare = $objWMIService.Get("Win32_Share")

$errReturn = $objNewShare.Create ("C:\Test", "PublicShare", $FILE_SHARE, $MAXIMUM_CONNECTIONS, "Public share me.")

Regards

ptrex

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0