Reputation: 83
I'd like to be able to combine a vbs script I made for a batch file into one .exe for an end user and so I can assign an icon to it. I've been trying to look for a way on the web but can't find anything that's useful.
I want to combine this vbs script:
Set oShell = CreateObject ("Wscript.Shell")
Dim strArgs
strArgs = "cmd /c CheckIn.bat"
oShell.Run strArgs, 0, false
With this batch file:
@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
I'm not sure if there's a simple way that's just eluding me at the moment, thanks in advance for your feedback.
Upvotes: 1
Views: 3774
Reputation: 743
If you send the taskkill without /f it's like a normal close. The user should be prompted to save emails. You can send it with /f later to force a close.
One way to achieve what you want is to put the batch commands into vbs oShell.Run commands. There is no need to put commands into variables before executing them and it makes your code confusing.
EG
oShell.Run "taskkill /IM DM.exe /F", 0, false
Then see this post on how to convert to an exe
How can I convert a VBScript to an executable (EXE) file?
PS: You should be able to run your script directly as a vb.net program rather than running it in the script control. Just put the vb.net headers and footers in.
Upvotes: 1