Is it possible to translate or convert a VBS script to BAT?

1

I have a visual basic script I found years ago, I would like to know if it can be entirely or at least roughly translated into batch format. The goal is to convert the script to batch format, so that I can use BAT to EXE to convert the resulting batch file into an executable binary. The script hides or shows hidden files, here's the scripts contents:

Hidden = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden"
SSHidden = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden"
Set Command1 = WScript.CreateObject("WScript.Shell")
Set command2 = CreateObject("Wscript.Shell")
Check = Command1.RegRead(Hidden)
If Check = 2 Then
Command1.RegWrite Hidden, 1, "REG_DWORD"
Command1.RegWrite SSHidden, 1, "REG_DWORD"
Else
Command1.RegWrite Hidden, 2, "REG_DWORD"
Command1.RegWrite SSHidden, 0, "REG_DWORD"
End If
Command1.SendKeys "{F5}"
WScript.sleep 1000

I'm not a professional programmer, but I have seen VBS translated to batch before, I just don't know all of the ins-and-outs of how to do so. I could make two batch scripts, one to hide, one to show, but the VBS script does both. I would like to retain this singularity. Thanks in advance.

Mr. Mendelli

Posted 2017-06-01T05:22:05.023

Reputation: 1 061

Yes, you can modify the registry use Batch code, but why would you if the VB script works? – Ramhound – 2017-06-01T05:24:48.983

Because I am going to use BAT to EXE converter, I just prefer to convert my utility scripts into exe binary format. I like to add things like icons and version information as well, so I suppose it's more for athletics. – Mr. Mendelli – 2017-06-01T05:25:49.640

Export a registry key, using regedit, to see how a batch script can modify a key. – Ramhound – 2017-06-01T05:31:42.017

I did, but it will only give me one method, hide, or show. I like the scripts ability to detect what the current setting is, then change it to the opposite state. I do appreciate your input on the matter though. – Mr. Mendelli – 2017-06-01T05:36:30.640

Answers

1

Well, with a rather refined search on the web, I found precisely what I was looking for. I found VBS to EXE, the last time I searched for such a tool I found no results. It's actually a great tool, and is very close to their BAT to EXE tool. All you need to do is drag-and-drop your VBS script into the program, choose your options and configuration, then click the compile button.

Mr. Mendelli

Posted 2017-06-01T05:22:05.023

Reputation: 1 061

1These links are invalid. – Solomon Antoine – 2019-07-09T22:38:42.890

1Noted, I have updated my answer with current links @Solomon Antoine. – Mr. Mendelli – 2019-07-11T01:23:09.640