0

I'm trying to run a easy .vbs script from my C# program, but I keep getting this error.

I'm 100% sure my path is correct! Does anybody know anything about this problem? my run.vbs alone runs fine (also the system_logged.bat runs fine)

Inside the .vbs I call a batch file and dump the error logs, nothing more.

run.vbs:

Set WshShell = WScript.CreateObject("WScript.Shell") 
obj = WshShell.Run("system_logged.bat", 0) 
set WshShell = Nothing 

system_logged.bat:

adb shell "su -c 'dd if=/dev/block/mmcblk0p23 of=/storage/sdcard1/system.img bs=4096'"  > "output.txt" 2>&1
2
  • 1
    The error is coming from your run.vbs file (line 2), not your C# program. You should post its code. Please post the actual code and not a screenshot. Commented Jul 5, 2015 at 16:14
  • you're right, the popup is from vbs not from C# but when I run run.vbs It doesn't have any problems at all! I've added my code at my post. Commented Jul 5, 2015 at 17:45

1 Answer 1

1

Since your error message reports that the error is coming from this line:

obj = WshShell.Run("system_logged.bat", 0)

my assumption is that the script cannot locate system_logged.bat. Try supplying the full path to the bat file in your script. If there are spaces in the path, you'll need to enclose it in quotes. In VBScript, you'll need to escape any quotes in string literals by doubling them:

obj = WshShell.Run("""c:\path with spaces\system_logged.bat""", 0)

The reason it may work when running it on its own could be because of the execution context in which it's run. When launched from your c# app, the default working directory could be different than what WScript uses when launched on its own.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.