2013-10-30 38 views
1

我希望能夠將我爲批處理文件所創建的vbs腳本合併爲一個用於最終用戶的.exe文件,因此我可以將一個圖標到它。我一直在試圖在網絡上尋找一種方式,但找不到任何有用的東西。如何將批處理文件和vbs腳本合併爲一個.exe

我想這個VBS腳本結合:

Set oShell = CreateObject ("Wscript.Shell") 
Dim strArgs 
strArgs = "cmd /c CheckIn.bat" 
oShell.Run strArgs, 0, false 

有了這個批處理文件:我不知道

@echo off 

REM A message to ask the user to save their Outlook emails they have open 

mshta javascript:alert("Please be sure to save any emails that you need in Outlook. Click OK to continue.");close(); 

REM This will stop DM, Email Marker, Email Filer, Interceptor, Papihost, and Outlook. 
taskkill /IM DM.exe /F 
taskkill /IM DMMarkEmail.exe /F 
taskkill /IM EmailAutoBulkFiling.exe /F 
taskkill /IM Interceptor.exe /F 
taskkill /IM OUTLOOK.EXE /F 
taskkill /IM PAPIHost.exe /F 

REM This will delete the DM cache in Appdata under the current user 
RMDIR /s /q "%userprofile%\Appdata\Roaming\OpenText\DM\Cache" 

REM This will start all of the programs that were closed 

REM DM and Interceptor restart when Outlook starts back up 
START OUTLOOK.EXE 

REM Commenting the Marker and Filer since some users don't want it 

REM START DMMarkemail.exe 
REM START Email AutoBulkFiling.exe 
REM START "C:\Program Files\Open Text\DM Extensions\DM.exe" 
REM START "C:\Program Files\Open Text\DM Extensions\Interceptor.exe" 
REM START PAPIHost.exe 
@echo off 

,如果有,這只是逃避我此刻的一種簡單的方法,謝謝提前收到您的反饋。

回答

1

如果你發送taskkill而不是/ f,就像正常關閉一樣。應提示用戶保存電子郵件。您可以稍後使用/ f發送它以強制關閉。

實現您想要的一種方法是將批處理命令放入vbs oShell.Run命令中。在執行它們之前,不需要將命令放入變量,這會使代碼混淆。

EG

oShell.Run "taskkill /IM DM.exe /F", 0, false 

然後再看如何轉換成一個exe這個帖子

How can I convert a VBScript to an executable (EXE) file?

PS:你應該能夠直接作爲vb.net程序運行你的腳本,而比在腳本控制中運行它。只需將vb.net的頁眉和頁腳放入。

相關問題