none
Problem with call RRS feed

  • Question

  • Hi to all

    i'm facing issue to call a program

    if i use this code

            Dim Test_Pgm As String
            Test_Pgm = "C:\Program Files (x86)\Zebra Technologies\ZebraDesigner 2\bin\Design.exe"
            Using proc = Process.Start(Test_Pgm)
    

    The program run without problem

    In my case i want to load the test_pgm from a txt file.

    If i load the txt file and add "[]" in the beginning and the end of the test pgm i take 2 different things

    From the code you see the msgbox show

    [C:\Program Files (x86)\Zebra Technologies\ZebraDesigner 2\bin\Design.exe]

    If i read it from a txt file the msgbox show

    [C:\Program Files (x86)\Zebra Technologies\ZebraDesigner 2\bin\Design.exe

    ]

    Why this happens?????

    Thanks and regards...

    Friday, October 5, 2018 1:09 PM

Answers

  • Have you tried using String.Trim ? Or perhaps there is a line feed in which case you would check for this and remove the line feed. Also it would be good to know what method is being used to read the text file and if there is one line or multiple lines in this file.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by Vagelisr Friday, October 5, 2018 1:21 PM
    Friday, October 5, 2018 1:20 PM
    Moderator

All replies

  • Hello, 

    You have SPACES in your full file name. 

    For the Process.Start() it looks like you have command WITH PARAMETERS - everything after space are accepted as a parameters.

    To prevent this you have options

    - put program into folder without spaces in the path

    - have whole program filename to be double quoted.


    Sincerely, Highly skilled coding monkey.

    Friday, October 5, 2018 1:17 PM
  • Have you tried using String.Trim ? Or perhaps there is a line feed in which case you would check for this and remove the line feed. Also it would be good to know what method is being used to read the text file and if there is one line or multiple lines in this file.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by Vagelisr Friday, October 5, 2018 1:21 PM
    Friday, October 5, 2018 1:20 PM
    Moderator
  • I forgot to remove the rem from trim :(

    Thanks anyway....

    Friday, October 5, 2018 1:22 PM