Jump to content
Sign in to follow this  
avery

@ComSpec Issues for me

Recommended Posts

avery

I am not sure this is my problem but it's the only thing I've been able to think up so far. I come here to get more advice hopefully.

The script runs perfect on the XP machine I compiled it on but not on the XP machine I need to run it on. The thing I found different so far is the directory Windows is installed in.

On my Windows XP box windows is located in the default location of C:\WINDOWS and the target uses C:\WINNT.

When I compile the script into a .exe does it take and store the @ComSpec from that machine or does it check each time on the machine it's being executed on?

Does anyone know a quick fix for this if you do believe it's the problem?

I was thinking of a simple if statement and losing the use of the @ComSpec built-in.

Thanks for any help you can offer.

Avery-

Func install_dod_inf()
; use /c flag to close window /k leaves it open to debuff
    ToolTip("This process could take several minutes. " & @CRLF & "Adding NISPOM CH8 Security and Permission settings." & @CRLF & "Ask you Security representative for more information." & @CRLF & "This Status Message will close when the process is complete.", 1, 1, "Status: DoD Security Tool", 1)
    Run(@ComSpec & ' /c secedit /configure /db "' & @ProgramFilesDir & '\NISP_Utilities\DoD.sdb" /cfg "' & @ProgramFilesDir & '\NISP_Utilities\DoD.inf" /verbose', "", @SW_HIDE)
    ToolTip("", 1, 1, "", 1)
EndFunc

When I run the exe, I get -1 error with something about 'not found'. Run fine on my box just not the target. This is just one function in a very big script.

Edited by avery

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites
SmOke_N

Did you try ShellExecute()?


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.

Share this post


Link to post
Share on other sites
avery

Did you try ShellExecute()?

ShellExecute("cmd.exe") will work on any setup no mater where Windows is installed?

Thanks,

Avery

edit:

ShellExecuteWait('cmd.exe /c secedit /configure /db "' & @ProgramFilesDir & '\NISP_Utilities\DoD.sdb" /cfg "' & @ProgramFilesDir & '\NISP_Utilities\DoD.inf" /verbose', "", @SW_HIDE)

cmd.exe is not found. looks like I still need to determine full path and add that :\

Edited by avery

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites
SmOke_N

ShellExecute("cmd.exe") will work on any setup no mater where Windows is installed?

Thanks,

Avery

edit:

ShellExecuteWait('cmd.exe /c secedit /configure /db "' & @ProgramFilesDir & '\NISP_Utilities\DoD.sdb" /cfg "' & @ProgramFilesDir & '\NISP_Utilities\DoD.inf" /verbose', "", @SW_HIDE)

cmd.exe is not found. looks like I still need to determine full path and add that :\

Ahh, do you have to run cmd.exe? I was suggesting you just try and run your .sdb or .inf file with parameters.

I can't remember how autoit gets the location.

Try this in place of @Comspec, use _myComspec()

_myComspec()

Func _myComspec()
    Local $t_comspec = DllStructCreate("char[260]")
    Local $a_comspec = DllCall("Kernel32.dll", "int", "GetEnvironmentVariable", "str", "COMSPEC", "ptr", DllStructGetPtr($t_comspec), "dword", 260)
    If IsArray($a_comspec) And $a_comspec[0] > 0 Then Return DllStructGetData($t_comspec, 1)
    Return SetError(1, 0, "")
EndFunc
I'd be interested to see if it is different.

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.

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  

×