Link to home
Start Free TrialLog in
Avatar of dscits
dscits

asked on

Convert VBS to exe

Hello,

I wrote a VBS script to run a program as another user, but the problem is the password is stored in plain text as the user. If possible, I would like to convert a VBS to a true exe, or just find a way to hide the password.
So far all the programs i've found convert it to a self extracting exe. Any suggestions on programs? Or anyone know a script that can accomplish what i'm trying to do? I'm open for any of these.

Thanks in advance.
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

Microsoft used to have available a VBScript Encoder, not sure if it's still around by try searching at http://download.microsoft.com/
It's not full-proof encryption, but obfuscate the password and prevent casual viewers from seeing it.
Depending upon what your script is and does using ADS as suggested here by t0t0  may be suitable in that you can hide your password in an alternate date stream which is effectively not there unless you know how to find it...

https://www.experts-exchange.com/questions/25000620/read-in-a-file-in-batch-script.html?cid=1133&anchorAnswerId=26130150#a26130150

Can we se what your script is doing and maybe it can be revised to use such methods?

Steve
Avatar of dscits
dscits

ASKER

Ok thanks i'll give that a try, I don't have time right now but i'll get back to you once I do. Meanwhile heres the script, so If you have any suggestions let me know. I found this online so I didn't handwrite it.

' ----- ExeScript Options Begin -----
' ScriptType: window,invoker
' DestDirectory: temp
' Icon: default
' OutputFile: C:\TaxPrep\TY09\Bin\TaxWorks\test.exe
' ----- ExeScript Options End -----
Option explicit
dim oShell
set oShell= Wscript.CreateObject("WScript.Shell")
oShell.Run "runas /user:administrator ""splash09.exe"""
WScript.Sleep 100
'Replace the string yourpassword~ below with
'the password used on your system. Include tilde
oShell.Sendkeys "mypassword~"
Wscript.Quit
ASKER CERTIFIED SOLUTION
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dscits

ASKER

Awesome thanks! I'll have to re-encode it with my password, But that should be the solution, I'll try it right now!
Avatar of dscits

ASKER

OK so that worked like a charm, thanks. So for the future people reading this I downloaded VBScript Encoder and encoded it.
To do that, open a command prompt and change to the directory you installed VBScript encoder to,
cd C:\program Files\Windows Script Encoder

Then I copied the VBS script to encode to the directory and ran
screnc.exe /f test.vbs         (it will overwrite your vbs file)

and rename the extension to test.vbe and it worked. Thanks!