How to get a text that is inside a quote

wscript.exe //B "C:\Users\S4LSAL~1\AppData\Local\Temp\virus.vbs"

And I wanted to get the route inside the quotes, so that this would stay:


I can not do this on, thanks in advance.

asked by S4L salsoft 18.11.2018 в 04:45

1 answer


good day. Unfortunately, you do not give us many details about how the variable that contains the entire route that you give us comes, if you were more specific, we would appreciate it. On the other hand, I offer you this solution:

    Dim path As String = "wscript.exe //B 'C:\Users\S4LSAL~1\AppData\Local\Temp\virus.vbs'"
    Dim i As Integer = path.IndexOf("'")
    Dim justpath As String = path.Substring(i + 1, path.IndexOf("'", i + 1) - i - 1)

With this you easily extract the string that is between the single quotes. I give you this solution since you do not give us more details. Greetings

answered by 18.11.2018 / 05:11