jmdess Posted July 19, 2007 Share Posted July 19, 2007 Hello. I do not see an AutoIt function to share a folder. Is sharing a folder with AutoIt possible, without of course calling an external program ? Thank you. jmd Link to comment Share on other sites More sharing options...
JavaCupiX Posted July 19, 2007 Share Posted July 19, 2007 (edited) What do you mean by "a function to share a folder"? Do you mean sharing a specified folder on your network?If this is what u want you can do it by using the "net share" command, here is the full documentation http://www.microsoft.com/resources/documen...e.mspx?mfr=true Edited July 19, 2007 by JavaCupiX Link to comment Share on other sites More sharing options...
jmdess Posted July 19, 2007 Author Share Posted July 19, 2007 (edited) Hello. What I mean by "share a folder" : In AutoIt, there is, between others, functions to work with map drives (DriveMapAdd, ...). I have to install a legacy program (setup is on a network share that I can map in the script with DriveMapAdd). This legacy program needs a share on the local c:\temp folder for the installation (and also after for execution). Hence I want to do the equivalent windows command "net share temp=c:\temp", but with a function in AutoIt, but also WITHOUT using run("cmd /C net share...") in AutoIt. jmd What do you mean by "a function to share a folder"? Do you mean sharing a specified folder on your network? If this is what u want you can do it by using the "net share" command, here is the full documentation http://www.microsoft.com/resources/documen...e.mspx?mfr=true Edited July 19, 2007 by jmdess Link to comment Share on other sites More sharing options...
JavaCupiX Posted July 19, 2007 Share Posted July 19, 2007 (edited) $strComputer = @ComputerName $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\"& $strComputer & "\root\cimv2") $objNewShare = $objWMIService.Get("Win32_Share") $errReturn = $objNewShare.Create("C:\Finance", "FinanceShare", 0, 25, "Public share for the Finance group.") This may help you... Edited July 19, 2007 by JavaCupiX Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 19, 2007 Share Posted July 19, 2007 Hi, ConsoleWrite(_freigebenOrdner("c:\downloads", "saugen", "Dies ist ein Freigabe test!")) Sleep(5000) ConsoleWrite(_freigebenOrdner("c:\downloads", "saugen", "", 1)) Func _freigebenOrdner($pfad, $freigabeName = "Datenfreigabe", $beschreibung = "Freigabe", $delete = 0) If $delete <> 0 Then Return RunWait(@ComSpec & ' /c net share ' & $freigabeName & ' /delete', '', @SW_HIDE) Else Return RunWait(@ComSpec & ' /c net share ' & $freigabeName & '=' & $pfad & ' /remark:"' & $beschreibung & '"', '', @SW_HIDE) EndIf EndFunc ;==>_freigebenOrdner So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
jmdess Posted July 19, 2007 Author Share Posted July 19, 2007 Thank you very very much. This works perfectly. $strComputer = @ComputerName $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\"& $strComputer & "\root\cimv2") $objNewShare = $objWMIService.Get("Win32_Share") $errReturn = $objNewShare.Create("C:\Finance", "FinanceShare", 0, 25, "Public share for the Finance group.") This may help you... Link to comment Share on other sites More sharing options...
JavaCupiX Posted July 19, 2007 Share Posted July 19, 2007 Hi, ConsoleWrite(_freigebenOrdner("c:\downloads", "saugen", "Dies ist ein Freigabe test!")) Sleep(5000) ConsoleWrite(_freigebenOrdner("c:\downloads", "saugen", "", 1)) Func _freigebenOrdner($pfad, $freigabeName = "Datenfreigabe", $beschreibung = "Freigabe", $delete = 0) If $delete <> 0 Then Return RunWait(@ComSpec & ' /c net share ' & $freigabeName & ' /delete', '', @SW_HIDE) Else Return RunWait(@ComSpec & ' /c net share ' & $freigabeName & '=' & $pfad & ' /remark:"' & $beschreibung & '"', '', @SW_HIDE) EndIf EndFunc ;==>_freigebenOrdner So long, Mega ^^ did you read the "but with a function in AutoIt, but also WITHOUT using run("cmd /C net share...") in AutoIt." before posting Link to comment Share on other sites More sharing options...
jmdess Posted July 19, 2007 Author Share Posted July 19, 2007 Thank you. But, if possible, I prefer not to launch another runwait by an external program (cmd.exe or other). Hi, ConsoleWrite(_freigebenOrdner("c:\downloads", "saugen", "Dies ist ein Freigabe test!")) Sleep(5000) ConsoleWrite(_freigebenOrdner("c:\downloads", "saugen", "", 1)) Func _freigebenOrdner($pfad, $freigabeName = "Datenfreigabe", $beschreibung = "Freigabe", $delete = 0) If $delete <> 0 Then Return RunWait(@ComSpec & ' /c net share ' & $freigabeName & ' /delete', '', @SW_HIDE) Else Return RunWait(@ComSpec & ' /c net share ' & $freigabeName & '=' & $pfad & ' /remark:"' & $beschreibung & '"', '', @SW_HIDE) EndIf EndFunc ;==>_freigebenOrdner So long, Mega Link to comment Share on other sites More sharing options...
dabus Posted July 19, 2007 Share Posted July 19, 2007 (edited) I don't get it... why is using wmi/vba/whatever better than using cmdline? You don't see anything at all and you may read out all the stderror or stdout that's generated by cmdline-programs. Just wondering... in this case, net is even bundled with windows. Edited July 19, 2007 by dabus Link to comment Share on other sites More sharing options...
JavaCupiX Posted July 19, 2007 Share Posted July 19, 2007 @dabus : I had a few examples for this, for example if you are in a safe Citrix session (or internet cafe system with very restricted programs) you won't allow any cmd.exe or net to work... I also think that using run and things like that isn't the cleanest solution... Link to comment Share on other sites More sharing options...
ChrisL Posted July 19, 2007 Share Posted July 19, 2007 Also on XP with simple file sharing enabled the share is read only using net share, the WMI method creates a share with read/write [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
dabus Posted July 19, 2007 Share Posted July 19, 2007 Ok guys, I think that count's (big time). Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 19, 2007 Share Posted July 19, 2007 Hi, LOL funny thread. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
dabus Posted July 19, 2007 Share Posted July 19, 2007 @Xeno: What's so funny? Safety, Citrix and Autoit in one sentence?? Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 20, 2007 Share Posted July 20, 2007 @Xeno: What's so funny? Safety, Citrix and Autoit in one sentence?? Hi,I found it funny because there are several solutions and nevertheless there is still a discussion.So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now