vb.net - Sending an argument to batch file with spaces. VB -


i using vb run .bat file , pass arguments it. right managed run , send arguments it, ran problem. arguments might contain spaces inside. trying use quotes, didn't seem work expected. doing:

  1. running code: system.diagnostics.process.start("c:\users\xxxxxxx\desktop\new.bat", """"+data+"""") 'data' argument sending. testing contains value:

hel loo

inside .bat file have code, opens notepad , writes argument inside it. code have managed pass argument 1 spaces, result is:

"hel loo"

any ideas how rid of quotes on each side, while still passing argument 1 spaces? cannot escape them or replace symbol. solution needs pass argument 1 spaces inside. possible? program working not important.

edit

this content of .bat file:

set directory_rexe="c:\users\xxxxxxx\desktop\testbat.txt"  set var=%1   echo %var%>%directory_rexe%  %directory_rexe% 

you have 3 options here:

  1. use %~1, strip quotes.
  2. don't care putting argument 1 , quoting , use %* instead. mentioned not wanting that, though.
  3. don't pass string argument, environment variable instead. helps lot when have number of characters in need escaped.

all options require change batch file, though.

i'd question need batch file when have capable programming language @ fingertips. writing text file should easier vb.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -