Results 1 to 4 of 4

Thread: Encoding issue?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    22

    Encoding issue?

    I believe this is an encoding issue due to the resulting output.

    The short of it:
    I am trying to make a batch file (meaning .bat) from VB.NET. The output looks fine in a normal text editor, but when executed via the command prompt, it keeps giving me syntax errors to start. I have a hunch it's due to the code that I'm using (or the lack thereof) that is causing the issue.
    As you can see below I've even tried using CharCodes, but still to no success. I'm sure it's just an encoding issue, but perhaps some outside help would do

    Code:
    Module Module1
        Sub fileop()
            Dim cd As String
            Dim fnd As String
            Dim del As String
            Dim ms As String
            Dim inp As String
            Dim cb As String
            Dim efnd As String
    
            efnd = Chr(32) & Chr(62) & Chr(32) & "output.log"
            If Form1.CheckBox1.Checked Then cb = " /I " Else cb = ""
            inp = Form1.TextBox1.Text
            ms = My.Settings.Setting2
            fnd = "@find "
            del = "@erase "
            cd = "@cd "
            Try
                Dim filePath As String
                filePath = System.IO.Path.Combine( _
                           My.Computer.FileSystem.SpecialDirectories.MyDocuments, "test.bat")
                My.Computer.FileSystem.WriteAllText(filePath, cd & ms & Environment.NewLine & fnd & Chr(34) & inp & Chr(34) & Chr(32) & "test.log" & cb & efnd & Environment.NewLine & del & filePath, False)
            Catch fileException As Exception
                Throw fileException
            End Try
    
    
        End Sub
    
    End Module

  2. #2

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    22

    Re: Encoding issue?

    There are 2 instances in which draw "non-system" characters in the command prompt. The first one is quite obvious.. it's gibberish, the second one the number "1" is not even in my code. So that is incorrect as well.
    Attached Images Attached Images  

  4. #4

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