Sign in to follow this  
Followers 0
archgriffin

RunWait complications

10 posts in this topic

Is there a particular reason this fails:

RunWait( 'C:\temp\postimage\devcon.exe sethwid @ROOT\PCI_HAL\0000 := !E_ISA_UP !ACPIPIC_UP !ACPIAPIC_UP !ACPIAPIC_MP !MPS_UP !MPS_MP !SGI_MPS_MP !SYSPRO_MP !SGI_MPS_MP  > nul'", @WorkingDir, @SW_SHOW)

I also tried it with with @ComSpec & " /k in front of it with an ending " but I get the same problem when it runs. A prompt shows just saying: "The filename, directory name, or volume label syntax is incorrect". I tried it with "cmd /k" and got the same thing. I was using /k because I wanted to see if that would come up with an error, same thing for the @SW_SHOW. The file devcon.exe is in the correct place.

There is actually a set of commands to be run and they are:

RunWait( 'C:\temp\postimage\devcon.exe sethwid @ROOT\PCI_HAL\0000 := !E_ISA_UP !ACPIPIC_UP !ACPIAPIC_UP !ACPIAPIC_MP !MPS_UP !MPS_MP !SGI_MPS_MP !SYSPRO_MP !SGI_MPS_MP  > nul', @WorkingDir, @SW_SHOW)
RunWait( 'C:\temp\postimage\devcon.exe sethwid @ROOT\ACPI_HAL\0000 := !E_ISA_UP !ACPIPIC_UP !ACPIAPIC_UP !ACPIAPIC_MP !MPS_UP !MPS_MP !SGI_MPS_MP !SYSPRO_MP !SGI_MPS_MP  > nul', @WorkingDir, @SW_SHOW)
RunWait( 'C:\temp\postimage\devcon.exe sethwid @ROOT\PCI_HAL\0000 := +ACPIAPIC_MP  > nul', @WorkingDir, @SW_SHOW)
RunWait( 'C:\temp\postimage\devcon.exe sethwid @ROOT\ACPI_HAL\0000 := +ACPIAPIC_MP  > nul', @WorkingDir, @SW_SHOW)
RunWait( 'C:\temp\postimage\devcon.exe update %windir%\inf\hal.inf ACPIAPIC_MP  > nul', @WorkingDir, @SW_SHOW)

However they all fail. Originally this was in a .cmd file and that works fine, but I am trying to just convert everything to autoit so it will be cleaner. This is part of a post imaging script I am attempting to belt out here, and this particular part changes the HAL to a multiprocessor HAL.

Also, if I just do the following RunWait("C:\temp\postimage\halmp.cmd", @WorkingDir, @SW_SHOW) it will run the cmd file just fine, the cmd file contains the following:

@echo off
devcon sethwid @ROOT\PCI_HAL\0000 := !E_ISA_UP !ACPIPIC_UP !ACPIAPIC_UP !ACPIAPIC_MP !MPS_UP !MPS_MP !SGI_MPS_MP !SYSPRO_MP !SGI_MPS_MP  > nul
devcon sethwid @ROOT\ACPI_HAL\0000 := !E_ISA_UP !ACPIPIC_UP !ACPIAPIC_UP !ACPIAPIC_MP !MPS_UP !MPS_MP !SGI_MPS_MP !SYSPRO_MP !SGI_MPS_MP  > nul
devcon sethwid @ROOT\PCI_HAL\0000 := +ACPIAPIC_MP  > nul
devcon sethwid @ROOT\ACPI_HAL\0000 := +ACPIAPIC_MP  > nul
devcon update %windir%\inf\hal.inf ACPIAPIC_MP  > nul

I apologize in advance if I am just missing something simple and just am over looking it.


"Human kind cannot gain anything without first giving something in return, to obtain; something of equal value must be lost."The Help File is truly your friend.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

There's an unpartnered " in the initial block of code, but I think it's just a typo unrelated to your problem.

In order to be able to use pipes or redirection ( like your > nul ) you need to be using @comspec as well, since those are things that are provided by the command shell.

Fix those two things and then if you still get an error please repost with what that error is.

Update: Looks like the most common cause of this error is a taboo character (==anything you can't put in the name of a file) in the path of your executable.

Edited by DaveF

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Share this post


Link to post
Share on other sites

Be sure to also try with ShellExecute instead of Run, and if you run in Windows Vista, for heavens sake don't forget to put @RequireAdmin in the top of your script! :)


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Thats #RequireAdmin. @ is a macro symbol.

Share this post


Link to post
Share on other sites

A just rectification, since no-one wants to mix macros with compiler directives... :)

I stand corrected! Thanks.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Seriously, I love this community, you people are awesome.

I will be checking this out when I get back to it on Monday. It is for Windows XP as we have no hope of using Vista yet, and this program particularly should always be ran from the local Administrator account because it is how things will be finished after imaging the machines. Hopefully, I will get this script done soon, and be able to place it, I believe in the examples area? I am sure people will be able to tighten it up a lot over all compared to how I will have it completed.


"Human kind cannot gain anything without first giving something in return, to obtain; something of equal value must be lost."The Help File is truly your friend.

Share this post


Link to post
Share on other sites

If you make something that works, it's always welcome in the example scripts. It's the code that doesn't work, or is poorly explained that has no reason to be in example scripts.

Share this post


Link to post
Share on other sites

First off, I do apologize for the long delay, I have been playing with this for most of the day along with a few other parts of the over all code.

OK, I have at least narrowed it down a little bit. Setup in the following method these lines appear to work:

ShellExecuteWait("C:\temp\postimage\devcon.exe", " sethwid @ROOT\PCI_HAL\0000 := !E_ISA_UP !ACPIPIC_UP !ACPIAPIC_UP !ACPIAPIC_MP !MPS_UP !MPS_MP !SGI_MPS_MP !SYSPRO_MP !SGI_MPS_MP > nul")
ShellExecuteWait("C:\temp\postimage\devcon.exe", " sethwid @ROOT\ACPI_HAL\0000 := !E_ISA_UP !ACPIPIC_UP !ACPIAPIC_UP !ACPIAPIC_MP !MPS_UP !MPS_MP !SGI_MPS_MP !SYSPRO_MP !SGI_MPS_MP > nul")
ShellExecuteWait("C:\temp\postimage\devcon.exe", " sethwid @ROOT\PCI_HAL\0000 := +ACPIAPIC_MP > nul")
ShellExecuteWait("C:\temp\postimage\devcon.exe", " sethwid @ROOT\ACPI_HAL\0000 := +ACPIAPIC_MP > nul")

Note: all of the above return 0, being DevCon's successful return, and @error also remains 0 after each of those commands.

However the last of them seems to fail:

ShellExecuteWait("C:\temp\postimage\devcon.exe", " update %windir%\inf\hal.inf ACPIAPIC_MP > nul")

If I set that for a variable, and return it, I am getting 2, which I think is the error code from devcon, 2 being failure, 0 being successful, and 1 meaning require reboot.

If I try it like this:

Runwait(@ComSpec & "/c" & 'C:\temp\postimage\devcon.exe update %windir%\inf\hal.inf ACPIAPIC_MP > nul')

It still fails, however if set to a variable is returning 0, @error for both, returns a 0.

If I open a command window on the machine and type in:

C:\temp\postimage\devcon.exe update %windir%\inf\hal.inf ACPIAPIC_MP > nul

It will work just fine. I tried changing the %windir% to C:\Windows but this made no difference. Is there just something in the command there that is making it fail? It is already being ran as the local admin and the machine is not even on the domain. The command works if manually input, or if ran from a .CMD file, just not through AutoIT in any way I am aware of?

@Richard Robertson

I wouldn't put it in the examples until it was working, but once it hits the "working" point I am sure the community would be able to have a tweakfest upon my coding.


"Human kind cannot gain anything without first giving something in return, to obtain; something of equal value must be lost."The Help File is truly your friend.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I think the problem is that you don't have a blank before and after /c. Try this

Runwait(@ComSpec & " /c " & 'C:\temp\postimage\devcon.exe update %windir%\inf\hal.inf ACPIAPIC_MP > nul')

Edited by cartman380

Share this post


Link to post
Share on other sites

Oh the pain of being destroyed by a blank SPACE!

I almost replied saying I tried that, but then I could not remember if I had or not, or maybe I had but possibly had changed something else since then to get what I posted.

Thank you!

I can finally move on to a few of the other steps for the entire script. Although since I am normally curious, why would it work in the RunWait, but the others do better under ShellExecuteWait? Not all that important, but good for reference, if anyone has the answer.


"Human kind cannot gain anything without first giving something in return, to obtain; something of equal value must be lost."The Help File is truly your friend.

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