Error 80070002 Wscript
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack wshshell.exec cannot find the file specified Overflow the company Business Learn more about hiring developers or posting ads with us 80070002 the system cannot find the file specified Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a run.vbs the system cannot find the file specified community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up wshShell.Exec Error 80070002 “The system cannot find the file specified” up vote 1 down vote favorite
Run.vbs 80070002
I'm trying to use either wshShell.Exec or wshShell.Run to run a script through another script. I have tried both methods, and both methods give me the same error. I've Googled the issue and can't find anything that seems to fix the issue. The only suggestion that really was very relevant was to try using wshShell.Run instead of Exec. Here's the relevant part of my script: strScriptPath = "T:\IT resources\Scripts\Shutdown Scripts" strForceShutdown c:\windows\run.vbs error = "ForceShutdown.vbs" For j = 0 to 99 Set objActive = wshShell.Run(strForceShutdown) ' In case I ever need to get this working to run it from another folder. ' Set objActive = wshShell.Exec("cd " & strScriptPath & "") ' Set objActive = wshShell.Exec("wscript " & strForceShutdown & "") constConf = MsgBox("Automatic shutdown initializing. Continue?" & chr(10) & "Y=Shutdown N=Postpone 30 minutes",4,"Automatic Shutdown Notification") If constConf = 7 Then objActive.Terminate Wscript.Sleep(1800000) Else objActive.Terminate Exit For End If Next Thanks for any help! shell vbscript exec wsh share|improve this question edited Feb 21 '15 at 10:14 Community♦ 11 asked Aug 20 '14 at 18:03 Adam Harvey 2517 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted Shell.Run returns an integer, so you can't call a method (Terminate) on its return value. You also can't Set it since it's not an object. You can call your shutdown script by just running it. Give it the full path, however, not a relative path. Scripts launched from Task Scheduler often have different "starting folders" than those launched manually so don't rely on your script finding the other one relatively. Also, you'll have to add Chr(34) before and after your path to account for any spaces. strForceShutdown = "c:\path\to\ForceShutdown.vbs" wshShell.Run C
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site windows script host code 80070002 About Us Learn more about Stack Overflow the company Business Learn more about
Objshell Run
hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
Error Code 80070002
the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up VBScript WScript.Shell Run() - http://stackoverflow.com/questions/25411514/wshshell-exec-error-80070002-the-system-cannot-find-the-file-specified The system cannot find the file specified up vote 5 down vote favorite 2 I'm trying to write a VBScript (.vbs) script that uses the WScript.Shell Run() method, but it seems as though Run() can't find the file I'm passing in. I've boiled my script down to the following code that will reproduce the results. This can be copied to a text editor, saved as test.vbs http://stackoverflow.com/questions/9432901/vbscript-wscript-shell-run-the-system-cannot-find-the-file-specified and ran. The type command simply outputs the text inside the file passed in. Dim WShell Set WShell = WScript.CreateObject("WScript.Shell") WShell.Run("type C:\inetpub\wwwroot\iisstart.htm") Set WShell = Nothing If you were to run the code in Run() directly from the CMD prompt, it works fine. But when it's run from inside a .vbs script and using Run(), it gives me the following error: Test.vbs(4, 1) (null): The system cannot find the file specified. I can run other commands using Run() just fine, but when I try to pass in a path it fails. Exec() fails with the same error by the way. Any ideas? vbscript wscript share|improve this question edited Feb 24 '12 at 15:25 asked Feb 24 '12 at 15:02 coryvb123 3401312 add a comment| 1 Answer 1 active oldest votes up vote 8 down vote accepted Try this Set oShell = CreateObject("WScript.Shell") strCmd = "cmd /K type C:\inetpub\wwwroot\iisstart.htm" oShell.Run(strCmd) Set oShell = Nothing share|improve this answer answered Feb 24 '12 at 15:28 Mcbeev 1,21979 Use of cmd.exe .k is necessary because TYPE isn't an actual executable program but rather an internal command within the CMD Command Processor. –Twisty Mar 23 at 19:53
be down. Please try the request again. Your cache administrator is webmaster. Generated Mon, 10 Oct 2016 08:32:23 GMT by s_ac15 (squid/3.5.20)
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Page 1 of 2 12 Last Jump to page: Results 1 to 10 of 16 Thread: WshShell.Exec error '80070002' Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 03-20-201011:35 PM #1 fishinggeek View Profile View Forum Posts Private Message Junior Member Join Date Mar 2010 Posts 11 WshShell.Exec error '80070002' trying to execute a asp function using wsh... Code: Function getSSOString(byval Data, byval strIV, byval strKey) dim strExec, retVal, objWShell, objCmd strExec = "echo " & Data & "| openssl enc -des3 -nosalt -iv " & strIV strExec = strExec & " -k " & strKey & " -a -A" set objWShell = CreateObject("WScript.Shell") if not objWShell.CurrentDirectory = "C:\OpenSSL\bin" then objWShell.CurrentDirectory = "C:\OpenSSL\bin" end if set objCmd = objWShell.Exec(strExec) retVal = objCmd.StdOut.Readall() set objCmd = nothing: set objWShell = nothing WScript.Quit getSSOString = retval End Function The line above that is bold is where my error seems to occur. Not sure why. I have given Everyone Read and Read\Execute permissions for the folder. Any help is appreciated. Reply With Quote 03-21-201008:36 AM #2 Russell M View Profile View Forum Posts Senior Member Join Date Dec 1969 Posts 6,476 test it What debugs have you tried? Maybe the values are not what you expected. response.write strExec just to see the values your dealing with before you use it. And possibly you can try trapping the error.... Function getSSOString(byval Data, byval strIV, byval strKey) dim strExec, retVal, objWShell, objCmd strExec = "echo " & Data & "| openssl enc -des3 -nosalt -iv " & strIV strExec = strExec & " -k " & strKey & " -a -A" on error resume next 'for error trapping set objWShell = CreateObject("WScript.Shell") if not objWShell.CurrentDirectory = "C:\OpenSSL\bin" then objWShell.CurrentDirectory = "C:\OpenSSL\bin" end if 'Write out the value to see what you have Response.write("
strExec = [" & strExec & "]
") Set objCmd = objWShell.Exec(strExec) 'ok lets see wh