VB调用GRADS后如何使进程里GRADS.EXE关闭
我编写了一个VB调用GRADS的小程序用于画图,但是每次运行完之后进程里总是有很多GRADS.EXE,累积起来就使我机子崩溃了。
For i = 1 To 72 Step 6
Open "D:\fnl\gs" & hut(i, 2) & ".gs" For Output As #i
Print #i, "'reinit'"
Print #i, "'open D:\fnl\hut" & hut(i, 2) & ".ctl'"
Print #i, ""
Print #i, "t1=1"
Print #i, "while(t1<=6)"
Print #i, "'set grads off'"
Print #i, "'set mpdset cnworld shanxi2_q shanxi2'"
Print #i, "'set lat 15 50'"
Print #i, "'set lon 90 130'"
Print #i, "'set t 't1"
Print #i, "'set lev 700'"
Print #i, ""
Print #i, "'set gxout contour'"
Print #i, "'set cint 1'"
Print #i, "'set cthick 6'"
Print #i, "'d hgtprs/10'"
Print #i, "'set gxout barb'"
Print #i, "'set cthick 3'"
Print #i, "'d ugrdprs*2.5;vgrdprs*2.5'"
Print #i, ""
Print #i, "'draw title 700hpa Num't1"
Print #i, "'enable print D:\fnl\gmf" & hut(i, 2) & "hgt&uv700.gmf '"
Print #i, "'print'"
Print #i, "'c'"
Print #i, "t1=t1+1"
Print #i, "endwhile"
Print #i, "'disable print'"
Print #i, ""
Print #i, "'reinit'"
Close #i
Next i
For i = 1 To 72 Step 6
FilePath = "D:\fnl\gs" & hut(i, 2) & ".gs"
x = Shell("C:\GrADS19\win32\grads.exe run -blc " + FilePath, 0)
Next i
如何解决这个问题,请教各位了,谢谢!
[最优解释]
shell "taskkill /im grads.exe"
[其他解释]
是在程序后面加上吗?出现无法删除怎么办?
[其他解释]
测试成功了,谢谢chinayuppie同学了!
[其他解释]
好像楼主用不上!~看到帖子都快隔了一年了!
但是我还是把我的方法将出来!
在 gs文件中
最后一行加一句话
'quit'
这样grads运行到这句话时就自己关闭了!~