[RESOLVED] Can't get .Bat file to run properly
I've got a web service that creates a .BAT file - that batch file does this
Code:
set path=D:\reporting\
amc rpt/printers
This runs an app in that folder called AMC.exe
It's supposed to create an AMC.log file - it does not.
But when I run that .BAT file from windows itself it does create the AMC.log file...
I've tried every security and sharing combination possible.
Re: Can't get .Bat file to run properly
Here is the code of the webservice - in case that all didn't make any sense!!
Code:
<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=False)> _
Public Function ReportService(ByVal fromwho As String, ByVal selection As IList(Of String), ByVal username As String) As String
Dim strReportFolder = System.Web.Configuration.WebConfigurationManager.AppSettings("reportfolder")
Dim strBatFile = Path.Combine(strReportFolder, "Report.bat")
Using fileWrtr = New StreamWriter(strBatFile, False)
fileWrtr.WriteLine("set path=" & strReportFolder & "\")
fileWrtr.WriteLine("amc rpt/printers")
fileWrtr.Close()
End Using
Process.Start(strBatFile)
Dim JsonMaker As JsonWriter = New JsonWriter
With JsonMaker
.StartObject()
.NewObject("yo", "dawg...")
.EndObject()
End With
Return JsonMaker.GetJson()
End Function
Re: Can't get .Bat file to run properly
Wow - my fault
It was creating the log file in this folder...
C:\Users\Steve\AppData\Local\VirtualStore\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
My .bat file was not setting the DIRECTORY properly...
oops