Results 1 to 3 of 3

Thread: [RESOLVED] Can't get .Bat file to run properly

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Resolved [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.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    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

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    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

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width