Jump to content
Sign in to follow this  
PsaltyDS

Run() Returned GetLastError of 267

Recommended Posts

I am prompting the user for a local account's password that will be used with RunAsSet.

I get the password, get re-entry to verify, then I want to test it by making a RunAsSet()/Run() call.

Not wanting the script to crash if the user just makes a mistake in the PW, I set Opt("RunErrorsFatal", 0).

When I execute the test:

Run(@ComSpec " /k ver.exe", @TempDir, @SW_SHOW)

The console window never opens, and I get @error = 1 and @extended = 267.

According to MSDN: System Error Codes (0-499):

ERROR_DIRECTORY

267

0x10B

The directory name is invalid.

Directory? What directory? :)

Am I looking this up in the wrong place?

To make sure I didn't just enter the wrong password (it is a long/complex password), I typed it into a Notepad window and copy/pasted from there. I right-clicked on notepad in the start menu and selected "Run as", then entered the user name and Ctrl-v pasted the password in. It worked fine. But when I Ctrl-v pasted the same password to my script's input box, I get the @error = 1 and @extended = 267 when it tries to Run().

Are there invalid characters that will throw off a password when passed from InputBox() to variable to RunAsSet()?

A debug MsgBox() inserted in the script shows the password is, in fact, correct.

Now what? How should I troubleshoot this?

:)

P.S. Temporarily reset the user account password to just "password" and still got the same errors. ^_^

Edited 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

Share this post


Link to post
Share on other sites

I assume that @tempdir is the temp directory of the original user and not accessible by the RunAsSet account.

Did you check what its value is ?

Share this post


Link to post
Share on other sites

I assume that @tempdir is the temp directory of the original user and not accessible by the RunAsSet account.

Did you check what its value is ?

No, but I had originally left it defaulted, just added that to see if it helped. I'll try it with C:\Temp explicit to see if it helps.

Just a sec...

^_^

...sure enough, that fixed it!

Thanks for the quick tip!

:)

Edited 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

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  

×
×
  • Create New...