Microsoft Developer Network >
Página Inicial dos Fóruns
>
.NET Base Class Library
>
how to use server.mappath(test.bat) in vb.net
how to use server.mappath(test.bat) in vb.net
- 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.
Respostas
- You can use
Application.StartupPath gives you the path executable of your application.
fi=New System.IO.FileInfo(Application.StartupPath & "\" & path)- Marcado como RespostaeryangMSFT, Moderadorquarta-feira, 11 de novembro de 2009 8:46
- Sugerido como RespostaTamer OzMVPsábado, 7 de novembro de 2009 16:08
- 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.- Marcado como RespostaeryangMSFT, Moderadorquarta-feira, 11 de novembro de 2009 8:46
Todas as Respostas
- 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)
- no i hve created a form in vb.net and for that i m using this code.tell me something vb.net
- You can use
Application.StartupPath gives you the path executable of your application.
fi=New System.IO.FileInfo(Application.StartupPath & "\" & path)- Marcado como RespostaeryangMSFT, Moderadorquarta-feira, 11 de novembro de 2009 8:46
- Sugerido como RespostaTamer OzMVPsábado, 7 de novembro de 2009 16:08
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?- 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.- Marcado como RespostaeryangMSFT, Moderadorquarta-feira, 11 de novembro de 2009 8:46

