B
bh
I'm trying to write code to execute a .bat file.
Code in simple test.bat file runs fine from command prompt:
@Echo off
dir > "test.txt"
I've tried the following methods on code-behinds of buttons on both both an
ASP.NET and on Windows form, to no avail.
Method 1: Shell("C:\test.bat")
Method 2: Dim i as integer = Shell("C:\test.bat")
Method 3: System.Diagnostics.Process.Start("C:\test.bat")
I've checked for file.exists("C:\test.bat"), and the file is recognized
through the code; however, when I run either of the 3 methods, above, the
program doesn't break and yet the new test.txt file is not created. On the
other hand, if I set a break-point & run, for example Shell("C:\test.bat")
from the command window, I get Command "shell("C:\test.bat") is not valid.
Any ideas what could be happening here? Thanks in advance.
bh
Code in simple test.bat file runs fine from command prompt:
@Echo off
dir > "test.txt"
I've tried the following methods on code-behinds of buttons on both both an
ASP.NET and on Windows form, to no avail.
Method 1: Shell("C:\test.bat")
Method 2: Dim i as integer = Shell("C:\test.bat")
Method 3: System.Diagnostics.Process.Start("C:\test.bat")
I've checked for file.exists("C:\test.bat"), and the file is recognized
through the code; however, when I run either of the 3 methods, above, the
program doesn't break and yet the new test.txt file is not created. On the
other hand, if I set a break-point & run, for example Shell("C:\test.bat")
from the command window, I get Command "shell("C:\test.bat") is not valid.
Any ideas what could be happening here? Thanks in advance.
bh