selder Posted February 20, 2008 Share Posted February 20, 2008 I have an AutoIt script that runs a BAT file directly from a network source. This BAT file is a bat file that another team changes when they see fit, and it needs administrative privileges on the local computer. My AutoIt script is on another network source. The line where I call the bat file is the following: RunWait ( @COMSPEC & " /c \\server\Sap\SapLogon_ChangeSystems.bat") My script works wonderfully when it is on a local harddrive (e.g. C:\ ), but not when I run it from a mapped network drive. Any ideas? Link to comment Share on other sites More sharing options...
YoungRacoon Posted February 20, 2008 Share Posted February 20, 2008 I have an AutoIt script that runs a BAT file directly from a network source. This BAT file is a bat file that another team changes when they see fit, and it needs administrative privileges on the local computer. My AutoIt script is on another network source. The line where I call the bat file is the following: RunWait ( @COMSPEC & " /c \\server\Sap\SapLogon_ChangeSystems.bat") My script works wonderfully when it is on a local harddrive (e.g. C:\ ), but not when I run it from a mapped network drive. Any ideas? I have the same problem. Eager to get the answer... Link to comment Share on other sites More sharing options...
Bert Posted February 20, 2008 Share Posted February 20, 2008 try shellexecute perhaps....?.... The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 20, 2008 Moderators Share Posted February 20, 2008 Did you try using RunAsSet? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 20, 2008 Share Posted February 20, 2008 (edited) I have an AutoIt script that runs a BAT file directly from a network source. This BAT file is a bat file that another team changes when they see fit, and it needs administrative privileges on the local computer. My AutoIt script is on another network source. The line where I call the bat file is the following: RunWait ( @COMSPEC & " /c \\server\Sap\SapLogon_ChangeSystems.bat") My script works wonderfully when it is on a local harddrive (e.g. C:\ ), but not when I run it from a mapped network drive. Any ideas? Your example is running it from a UNC, not a mapped drive letter. Did you try mapping it first? $MapDrv = DriveMapAdd("*", "\\server\Sap") If @error = 0 Then RunWait(@ComSpec & ' /c ' & $MapDrv & '\SapLogon_ChangeSystems.bat') Else MsgBox(16, "Error", "Error mapping drive to \\server\Sap") EndIf Edit: Didn't like the error handling I had for DriveMapAdd. Edited March 28, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
selder Posted February 21, 2008 Author Share Posted February 21, 2008 Yes, I am using a RunAsSet() in that script, and there is no problem accesing the network shares (I'm using a domain admin account with generated password of about 50 characters. Anyway, I tried mapping the network share, but that doesn't solve the problem. Running the compiled AutoIt exe from a network share doesn't work. Copying that same exe locally (C:\ ) works just fine. I just don't understand why it would work locally and not on a network source. Link to comment Share on other sites More sharing options...
airboss2112 Posted March 28, 2008 Share Posted March 28, 2008 Same thing here......Did you ever resolve? Link to comment Share on other sites More sharing options...
notorius Posted March 29, 2008 Share Posted March 29, 2008 (edited) Well i dont know how many Stuff is written in that .bat file. Maybe you try putting your stuff completely into autoit like this: #include <Process.au3> _RunDOS("DOS-Command here") _RunDOS("DOS-Command here") _RunDOS("DOS-Command here") I managed my bat files like this, working like a charm. I compiled them, and everytime i add a new Workstation to my Network, i just run my exe. Hope this helps you a bit. Edited March 29, 2008 by notorius Link to comment Share on other sites More sharing options...
Danny35d Posted March 29, 2008 Share Posted March 29, 2008 (edited) Try adding the working directory.RunWait ( @COMSPEC & " /c \\server\Sap\SapLogon_ChangeSystems.bat", "\\server\Sap") Edited March 29, 2008 by Danny35d AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Carlo Posted March 31, 2008 Share Posted March 31, 2008 Try RunWait ( @COMSPEC & " /c \\server\Sap\SapLogon_ChangeSystems.bat", @WindowsDir) I have an AutoIt script that runs a BAT file directly from a network source. This BAT file is a bat file that another team changes when they see fit, and it needs administrative privileges on the local computer. My AutoIt script is on another network source. The line where I call the bat file is the following: RunWait ( @COMSPEC & " /c \\server\Sap\SapLogon_ChangeSystems.bat") My script works wonderfully when it is on a local harddrive (e.g. C:\ ), but not when I run it from a mapped network drive. Any ideas? Link to comment Share on other sites More sharing options...
everseeker Posted March 31, 2008 Share Posted March 31, 2008 TryRunWait ( @COMSPEC & " /c \\server\Sap\SapLogon_ChangeSystems.bat", @WindowsDir)Also, you could try to change to a .CMD extension...... Everseeker Link to comment Share on other sites More sharing options...
rudi Posted March 31, 2008 Share Posted March 31, 2008 Hi. Wrap your UNC addressed batch file into a locally started one. Use "pushd" to temporarily assign a network drive letter to the UNC path of your batch. Then run it use "popd" to remove the temp mapping finally. Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
selder Posted June 3, 2008 Author Share Posted June 3, 2008 Thanks all, adding that working directory at the end of the code did the trick! 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