Microsoft Developer Network > 포럼 홈 > .NET Base Class Library > how to use server.mappath(test.bat) in vb.net
질문하기질문하기
 

답변됨how to use server.mappath(test.bat) in vb.net

  • 2009년 11월 7일 토요일 오후 12:46kokila1986 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Dim path As String
            path = "test.bat"
            Dim sw As System.IO.StreamWriter
            Dim fi As System.IO.FileInfo 
            fi = New System.IO.FileInfo(Server.MapPath(path))
            sw = fi.CreateText()
            'The List Of Operations you want to execute.
            sw.WriteLine("cd c:\\")
            sw.WriteLine("md c:\\dummy")
            sw.WriteLine("cd dummy")
            sw.WriteLine("C:\\winJavaCoverage\\bin\\javacoverage -F c:\\test.java")
            sw.WriteLine("javac Pack\\Test.java")
            sw.WriteLine("java Pack\\Test")
            sw.Close()

    this is the code i hve used behind my form in vb.net.it is not wrking as it is showing error as server in server.mappath is not declared.i dnt know what to do.i hve tried my best.can u pls tell me so that i can run and gets the benefit.

답변

  • 2009년 11월 7일 토요일 오후 2:00Tamer OzMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    You can use

    Application.StartupPath gives you the path executable of your application.

    fi=New System.IO.FileInfo(Application.StartupPath & "\" & path)
  • 2009년 11월 7일 토요일 오후 4:08Tamer OzMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Response.Write writes a string to the response stream with another saying basicly in page in asp.net

    In windows forms you can use MessageBox.Show to show messages.

모든 응답

  • 2009년 11월 7일 토요일 오후 12:50Tamer OzMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     코드 있음
    Server.Mappath could only be used in asp.net applications.

    Is your application Asp.net or Windows Application.

    If it is asp.net application try.

    System.Web.HttpContext.Current.Server.MapPath(Path)
    
  • 2009년 11월 7일 토요일 오후 1:57kokila1986 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    no i hve created a form in vb.net and for that i m using this code.tell me something vb.net
  • 2009년 11월 7일 토요일 오후 2:00Tamer OzMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    You can use

    Application.StartupPath gives you the path executable of your application.

    fi=New System.IO.FileInfo(Application.StartupPath & "\" & path)
  • 2009년 11월 7일 토요일 오후 4:06kokila1986 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    thank u so much for ur response.this helped me.

    can u tell me 1 mre thing.

    this.Response.Write(String.Format(fmtOutput, results.Replace(System.Environment.NewLine, "")))

    the above statement gives error as response is not declared.i have done few things like i hve used me instead of this or form1.

    but nothing works.can u tell me what shd i do?

  • 2009년 11월 7일 토요일 오후 4:08Tamer OzMVP사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Response.Write writes a string to the response stream with another saying basicly in page in asp.net

    In windows forms you can use MessageBox.Show to show messages.