Sign in to follow this  
Followers 0
Gllopc

VB script not running when called due to UNC path

11 posts in this topic

Hello all, I have an issue that I think it pretty easy, but I'm just not experienced enough to know the exact answer.

When calling a VB Script from my AutoIt script, the VB script executes, but then gives a "cannot find the file specified" error. When running the VB script from explorer or Start|Run, it works perfectly, regardless of whether using a UNC path or drive letter.

The purpose of the VB script is to start a program installation, do some other actions for cleanup, and then exit. I don't have the option of modifying the VB script.

I'm calling the Visual Basic script from it's UNC path using the command interpreter, as AutoIt will not execute VBS files. I do not have the option of using a drive letter and I have to use a UNC path. I use the following code:

RunWait(@ComSpec & ' /c ' & @WorkingDir & '\intel\s1\smscert-standard-profiles.vbs', "", @SW_HIDE)

The AutoIt script is being run from a UNC path.

This successfully calls the VB script, and so in essence it's not an AutoIt issue; but, the problem I have is that the VB script does not know it's working path, and so it errors out when it tries to call a program from within itself.

Again, if I then opened Start|Run and then typed in the UNC path of the script and it's name it works perfectly.

Any ideas?

Share this post


Link to post
Share on other sites



Hello all, I have an issue that I think it pretty easy, but I'm just not experienced enough to know the exact answer.

When calling a VB Script from my AutoIt script, the VB script executes, but then gives a "cannot find the file specified" error. When running the VB script from explorer or Start|Run, it works perfectly, regardless of whether using a UNC path or drive letter.

The purpose of the VB script is to start a program installation, do some other actions for cleanup, and then exit. I don't have the option of modifying the VB script.

I'm calling the Visual Basic script from it's UNC path using the command interpreter, as AutoIt will not execute VBS files. I do not have the option of using a drive letter and I have to use a UNC path. I use the following code:

RunWait(@ComSpec & ' /c ' & @WorkingDir & '\intel\s1\smscert-standard-profiles.vbs', "", @SW_HIDE)

The AutoIt script is being run from a UNC path.

This successfully calls the VB script, and so in essence it's not an AutoIt issue; but, the problem I have is that the VB script does not know it's working path, and so it errors out when it tries to call a program from within itself.

Again, if I then opened Start|Run and then typed in the UNC path of the script and it's name it works perfectly.

Any ideas?

have you tried?

RunWait(@ComSpec & ' /c ' & @WorkingDir & '\intel\s1\smscert-standard-profiles.vbs', @WorkingDir , @SW_HIDE)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Same thing I'm afriad. I tried several different combinations, such as removing the first @WorkingDir and replacing it with the exact UNC, but no luck. Hmmm....

have you tried?

RunWait(@ComSpec & ' /c ' & @WorkingDir & '\intel\s1\smscert-standard-profiles.vbs', @WorkingDir , @SW_HIDE)
Edited by Gllopc

Share this post


Link to post
Share on other sites

Something to note is that I can circumvent the problem by doing the following:

Send("#r")

WinWaitActive("Run")

Send(@WorkingDir & "\intel\s1\smscert-standard-profiles.vbs{Enter}")

Which starts Run and inserts the location of the VB script and it's name, and then hits "OK".

The reason I can't do this is that it's considered sloppy and unreliable.

Share this post


Link to post
Share on other sites

Are you using RunAsSet?


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

Yeah, I tried and I'm afraid it didn't make any difference.

I tried both a domain account with admin privs, and a local admin account.

Are you using RunAsSet?

Share this post


Link to post
Share on other sites

I've considered doing this, but I thought I'd try referencing CSCRIPT.EXE first, and see how that responds. It actually didn't make any difference.

It looks like I'm going to have to modify the VB script itself - which I didn't want to do. I'll try that and report back.

Thanks Everyone for all the suggestions and input.

I would just get the beta and convert it autoit, then shouldn't have to worry about it.

Share this post


Link to post
Share on other sites

Well, it looks like the fix to the problem is to add a couple of lines to the vb script:

set shell = createobject("wscript.shell")

shell.currentdirectory = wscript.scriptfullname & "\.."

wscript.echo shell.currentdirectory

Just add it to the top of the script. The last line is really just a message box that displays the scripts current working directory, and can ultimately be ommited.

Oh well, this is a fault in VB Script, and not AutoIt.

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