0
votes

I am trying to do a simple function that will call one VBScript file and run that simultaneously to the script that is currently running. I have searched online and I discovered a technique using WScript.Shell object, however since my company switched to Windows 7, it doesn't seem to work the way it did in Windows XP. I'm hoping this is some stupid issue with my code, but it keeps giving me the error:

Script_Call_tester.vbs(5, 2) (null): The system cannot find the file specified.

I did export the file path and name for the script I am trying to call, and when I paste it into the run prompt, it does find the script.

sendExports("Script_Called_tester.vbs")
function sendExports(iScript)
    dim objShell
    set objShell = CreateObject("WScript.Shell")
    objShell.Run "\\path\" & iScript
    set objShell = Nothing
    wscript.echo("call worked")
    wscript.sleep(3000)
end function
1
The system cannot find the file specified. Which file? The script or the host executable? Try objShell.Run """" & "\\path\" & iScript & """" or objShell.Run WScript.FullName & " \\path\" & iScript or a combination... - JosefZ
The most likely explanation is that your obfuscated path \\path\Script_Called_tester.vbs contains a space somewhere. The first sample from @JosefZ's comment should take care of that. Not much else we could tell you without more information. - Ansgar Wiechers
Another possibility that, by a mistake, the \\path refers to non-existing host name of a server or the domain name of a domain hosting resource named path; not much else we could tell you without more information about real invocation of that path string and it's meaning - JosefZ

1 Answers

0
votes

I do not think it is anything to do with Windows 7.

Script_Called_tester.vbs Copy this file from the network location and place it in your local machine. Update the path in the script to your local. Run it. Does it work fine? (It should)

What happens when you try to access this \path\Script_Called_tester.vbs directly in the 'Windows search Programs and files".

Are you able to find?