neo van matix Posted April 12, 2006 Share Posted April 12, 2006 Hello, i've written a little script, which copies some Win2k Updates from a Server to a local folder. Then, it should run the install.bat, which install the updates. But, if i run the script, it copies the complete Folder - the install.bat appears for half a second - and then the folder will be deleted. If i run the install.bat via doubleclick in Windows, it works fine :/ DirCopy("\\192.168.1.28\d$\AutoIT-Scripts\Win2k_Updates", "c:\Win2k_Updates") Run("c:\Win2k_Updates\install.bat") ProcessWaitClose("install.bat") sleep(5000) DirRemove("c:\Win2k_Updates", 1) Attention! English noob ^^ Link to comment Share on other sites More sharing options...
nfwu Posted April 12, 2006 Share Posted April 12, 2006 Try:Run("run c:\Win2k_Updates\install.bat") If that does not work, this data may help: It's default opener is {5e941d80-bf96-11cd-b579-08002b30bfeb} This can be seen by the registry key: HKEY_CLASSES_ROOT\.bat\PersistentHandler #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 12, 2006 Share Posted April 12, 2006 Hello, i've written a little script, which copies some Win2k Updates from a Server to a local folder. Then, it should run the install.bat, which install the updates. But, if i run the script, it copies the complete Folder - the install.bat appears for half a second - and then the folder will be deleted. If i run the install.bat via doubleclick in Windows, it works fine :/ DirCopy("\\192.168.1.28\d$\AutoIT-Scripts\Win2k_Updates", "c:\Win2k_Updates") Run("c:\Win2k_Updates\install.bat") ProcessWaitClose("install.bat") sleep(5000) DirRemove("c:\Win2k_Updates", 1) Try it like this: DirCopy("\\192.168.1.28\d$\AutoIT-Scripts\Win2k_Updates", "c:\Win2k_Updates") RunWait(@ComSpec & ' /k c:\Win2k_Updates\install.bat', 'c:\Win2k_Updates\install.bat') MsgBox(64, "Debug", "Install.bat complete, check results...") DirRemove("c:\Win2k_Updates", 1) That way you can see if it is working the way you want. 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...
neo van matix Posted April 12, 2006 Author Share Posted April 12, 2006 Doesnt work :/ run("run ..."): I get an Error, that the script cant find the install.bat Psaltyds: Error, too: "Dirname not valid" :/ Wtf, why run() cant open a simple *.bat files? Attention! English noob ^^ Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 12, 2006 Share Posted April 12, 2006 (edited) Doesnt work :/ run("run ..."): I get an Error, that the script cant find the install.bat Psaltyds: Error, too: "Dirname not valid" :/ Wtf, why run() cant open a simple *.bat files? Of course it can run .bat files. That "Dirname not valid" needs to be chased to ground first... Like this, for instance: If Not DirCopy("\\192.168.1.28\d$\AutoIT-Scripts\Win2k_Updates", "c:\Win2k_Updates") Then MsgBox(16, "Error!", "DirCopy failed! What happened to c:\Win2k_Updates\Install.bat?") Exit EndIf RunWait(@ComSpec & ' /k c:\Win2k_Updates\install.bat', 'c:\Win2k_Updates\install.bat') MsgBox(64, "Debug", "Install.bat complete, check results...") DirRemove("c:\Win2k_Updates", 1) After you find out what happened to your DirCopy(), change the /k back to /c and delete the Debug MsgBox. :-) Edited April 12, 2006 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...
b1t5tR3@m Posted April 12, 2006 Share Posted April 12, 2006 Batch files have a quirk to them with regard to how and where they are run... First, are you running your script in the same dir as the .bat file? If so, do this: DirCopy("\\192.168.1.28\d$\AutoIT-Scripts\Win2k_Updates", "c:\Win2k_Updates") Run("c:\Win2k_Updates\install.bat", "", @SW_HIDE) ProcessWaitClose("install.bat") sleep(5000) DirRemove("c:\Win2k_Updates", 1) If however you are running the script from another location, use this: DirCopy("\\192.168.1.28\d$\AutoIT-Scripts\Win2k_Updates", "c:\Win2k_Updates") Run("c:\Win2k_Updates\install.bat", "c:\Win2k_Updates", @SW_HIDE) ProcessWaitClose("install.bat") sleep(5000) DirRemove("c:\Win2k_Updates", 1) Additionally I would just modify your code above to the following: (If script in same Dir) DirCopy("\\192.168.1.28\d$\AutoIT-Scripts\Win2k_Updates", "c:\Win2k_Updates") RunWait("c:\Win2k_Updates\install.bat", "", @SW_HIDE) sleep(5000) DirRemove("c:\Win2k_Updates", 1) This will pause execution of the script until the installation is complete, then continue on with "Sleep()" and "DirRemove" Link to comment Share on other sites More sharing options...
BigDod Posted April 12, 2006 Share Posted April 12, 2006 Try DirCopy("\\192.168.1.28\d$\AutoIT-Scripts\Win2k_Updates", "c:\Win2k_Updates") $prog = FileGetShortName("c:\Win2k_Updates\install.bat") Run($prog) ProcessWaitClose("install.bat") sleep(5000) DirRemove("c:\Win2k_Updates", 1) Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 12, 2006 Share Posted April 12, 2006 (edited) b1t5tR3@m, I love your avitar... Do you set a different one on GOOD days? Edited April 12, 2006 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...
CyberSlug Posted April 12, 2006 Share Posted April 12, 2006 (edited) I think the problem in your original script is the assumption in the line ProcessWaitClose("install.bat")When a batch file is run, cmd.exe is what appears in the Task Manager's process list--not the name of the bat file. As other people have shown, RunWait is the command you are looking for Would it be possible to get rid of the batch file and use built-in AutoIt commands?Also, using FileChangeDir sometimes works better:FileChangeDir("C:\Win2k_Updates") RunWait("install.bat","",@SW_HIDE) MsgBox(0,"Debug","Program is done!") Edited April 12, 2006 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
b1t5tR3@m Posted April 12, 2006 Share Posted April 12, 2006 @PsaltyDSThat's my "Whilst debugging code...." Avatar; and that IS on a good day. Link to comment Share on other sites More sharing options...
neo van matix Posted April 12, 2006 Author Share Posted April 12, 2006 I've found an easier way ^^. I created an SFX archiv with WinRar, witch runs after extraction the included install.bat. The sfx will be opend trough a autoit-script, which waits to close until the install.bat finished. Its a little bit complicated, and my bad english will not help u to understand, what i want to do *g*. I write a little installscript, which installs 10-20 autom. Installations. After 1 Program was installed, i force a reboot. As long as the autoit-script is open, nothing happens. 10 Seconds after the autoit-script finished, the script forces a reboot. After boot, the main installer-script starts again... and continues with the next program. Hm, unimportant... ^^ Attention! English noob ^^ Link to comment Share on other sites More sharing options...
alaa777 Posted May 5, 2013 Share Posted May 5, 2013 (edited) ShellExecute("install.bat","","c:Win2k_Updates") Edited May 5, 2013 by alaa777 Link to comment Share on other sites More sharing options...
mikell Posted May 5, 2013 Share Posted May 5, 2013 7 years later ... nice exhumation Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 6, 2013 Moderators Share Posted May 6, 2013 alaa777, as mikell alluded to, please do not resurrect a 7 year old thread just to make a comment. As the OP has not been active in nearly 2 years, it is unlikely that A: he is still looking to update Windows 2000 B: he will benefit from your advice anyway. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Bert Posted May 6, 2013 Share Posted May 6, 2013 Well, his action did get nominated for a zombie thread award... The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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