2010-11-22 134 views
0

当用户单击名为“Print”的命令按钮时,我需要从VB6代码中备份访问数据库。我在想,一个单独的批处理文件将是理想的。如何导致批处理文件从VB运行?一旦批处理文件可以被激活,我应该能够使用简单的xcopy命令将数据库复制到可移动的驱动器。所有帮助非常感谢。在VB6代码中运行批处理文件

+0

Offtopic,但是当用户点击名为“Backup”的按钮时,应用程序应该执行什么操作? – Arvo 2010-11-22 08:13:56

回答

5
Shell("path-to-batch-file", vbHide) 

当然,如果你不想隐藏它,这里有一个选项列表。

vbHide    0 Window is hidden and focus is passed to the hidden window. 
vbNormalFocus  1 Window has focus and is restored to its original size and position. 
vbMinimizedFocus 2 Window is displayed as an icon with focus. 
vbMaximizedFocus 3 Window is maximized with focus. 
vbNormalNoFocus  4 Window is restored to its most recent size and position. The currently active window remains active. 
vbMinimizedNoFocus 6 Window is displayed as an icon. The currently active window remains active.