請問一下怎麼讓FileListBox指向的檔案路徑傳到命令提示字元??<br>就是我要做一個程式是要可以用FileListBox找到數個檔案檔案.然後在textbox輸入dos指令處理他.<br>可是我試了幾個辦法都不能把路徑傳到命令提示字元<br>請各位前輩幫幫忙.在此感謝
目前的程式碼 Private Sub cmdDo_Click() ReDim strFile(5) As String ReDim strFilePath(5) As String Dim I As Integer 'filFiles的index值 Dim J As Integer For I = 0 To filFiles.ListCount - 1 ReDim strFile(filFiles.ListCount) ReDim strFilePath(filFiles.ListCount) For J = 0 To filFiles.ListCount If filFiles.Selected(I) Then '將user所選起來的檔案檔名存到strFile strFile(J) = filFiles.List(I) strFilePath(J) = filFiles.Path + strFile(J) End If Next J '指令傳入指令傳入命令提示字元 Shell "cmd /k " & Text1 & strFilePath(I), vbNormalFocus Next I End Sub shell那裡放錯了.會跑3個命令提示字元
如果filFiles.ListCount=4,就會跑3個命令提示字元;因為Shell指令放在For I ~ Next I迴圈內 想在同一個Dos命令視窗內執行數個指令,先製成Dos下的.bat檔再執行該bat檔 或參考 http://vbtester.24cc.com 實驗範例75