Home > Software engineering >  VB call bat batch command after the operation is invalid, double-click the bat useful operation
VB call bat batch command after the operation is invalid, double-click the bat useful operation

Time:10-06


As title, I rookie a VB, just began to learn, using VB recently by a shell called bat batch command, you can call, bat DOS command window will start, but there were no running effect, double-click the bat file is running effect, please people
The code below

Lujing=App. Path & amp; "\ TC - 9 _hextobin. Bat"
The Open lujing For Output As # 1
Binpath=Left (newwenjian, Len (newwenjian) - 3) & amp; "Bin"
Print # 1, "TargetFileConverter. Exe - hex2bin" & amp; CRH (& amp; H22) & amp; Newwenjian & amp; CRH (& amp; H22) & amp; "" & amp; CRH (& amp; H22) & amp; Binpath & amp; CRH (& amp; H22) & amp; "- pad 0 XFF - align 0 x4000"
Close # 1

Shell lujing, vbNormalFocus
Roughly as follows, by opening the TC - 9 _hextobin. Bat, modify the TC - 9 _hextobin. The content of the bat, call an external application TargetFileConverter. Exe, convert hex file to bin directory with the name with hex file
VB call a DOS window appears, but no bin files are generated, VB call after the TC - 9 _hextobin. Bat content is correct, double click the TC - 9 _hextobin. Bat can automatically generate the bin file
If the document path for TC - 9 _hextobin. Bat in the same folder can be automatically generated bin file, the other path is not line, will not generate bin file, double click the TC - 9 _hextobin. Bat can be generated

CodePudding user response:

Round round:

Vb shell method calls a bat

Bat it and write a call exe

CodePudding user response:

You use relative path calls the exe, of course, to ensure that the correct path,
Call with the following statement,
 ChDrive Left $(App) Path, 2) 
ChDir App. Path

CodePudding user response:

Folder have space

Shell CRH (34) & amp; Lujing & amp; CRH (34), vbNormalFocus

CodePudding user response:

Call you directly with a Shell that Convert. Exe file, you run the BAT anyway to modify a BAT, also called
Shell TargetFileConverter. Exe - hex2bin "" "" & amp; Newwenjian & amp; "" "" "" & amp; Binpath & amp; "" "- pad 0 XFF - align 0 x4000 ", vbNormalFocus
  • Related