• 0

How to import .VBS code to VB Express?


Question

So i have a lot of .VBS files i created and wanted to imoprt them to VB Express which is free from MS and i have installed.

I believe i can compile them to .exe if i do this?

Question is, am i right? If so, how do i do it, beacuse i cant see an easy way?

Sorry for such n00b questions, but im VERY new at this.

Cheers,

Rich

Link to comment
https://www.neowin.net/forum/topic/565895-how-to-import-vbs-code-to-vb-express/
Share on other sites

18 answers to this question

Recommended Posts

  • 0

A script is simply executing commands. Your program IS the command, in a sense. Now, you can have your program "script" things, but fundamentally it's doing the same thing as your script.

Let me ask you this. Why do you want to compile your scripts into a EXE?

  • 0
  Endo. said:
You can not simply convert a .vbs script into an executable, but you could transform the code so that it was compatible with whichever outcome you wanted. Its hard to explain, but possible, if you think outside the box.

Its not that i want to compile it to a .exe as such.

  John said:
A script is simply executing commands. Your program IS the command, in a sense. Now, you can have your program "script" things, but fundamentally it's doing the same thing as your script.

Let me ask you this. Why do you want to compile your scripts into a EXE?

Basically i think programming is something i should start looking at as i find it fasinating. A few web sites have said that script language is very similar to VB.

However, what i really want to do is create a VB program which does all the same things as some scripts i have created.

I have created a script that asks you to enter a location of a file, such as Word.exe and once you have entered it, it will run with the admin username and password, however all i can do to hide the admin password is encrypt the file, which is easy to decrypt, so in the wrong hands the file could be dangerous to our system.

So if i could create a program which does the same function, then surely that admin password would be safer?

  • 0
  Endo. said:
So you want to make simplistic login system? Question... is the username and password data subject to change?

Not to log in, just to run a file with the admin account instead of the account you have logged in with.

So rather than right clicking the file and selecting run as and then entering the user name and password, they will run this file instead, enter the file location and then it will run that file automatically with the admin user name and password.

The password and username are not subject to change any time in the forseeable future.

Perhaps i need to know if there is anywhere which can teach me basic VB language skills?

  • 0

Please be clear on this. VBScript is the scripting derivative of Visual Basic 6.

In VB Express you code VisualBasic.net - a completely new language.

VBS and VB6, although vastly different, share a syntax to an extent. VB.net is totally new.

As such, you need to map out what your VBS does logically (not code but more a flowchart) and then learn VB.net to completely re-code it.

  • 0
  njlouch said:
Please be clear on this. VBScript is the scripting derivative of Visual Basic 6.

In VB Express you code VisualBasic.net - a completely new language.

VBS and VB6, although vastly different, share a syntax to an extent. VB.net is totally new.

As such, you need to map out what your VBS does logically (not code but more a flowchart) and then learn VB.net to completely re-code it.

Thanks Nik. I think my head is about to explode now! :laugh:

In that case i guess what im asking is not technically possible.

Is there some resources you guys know of that will help me learn even basic VB.net?

  • 0

Hi Rich,

It should definitely be technically possible to do what you want, yes.

I'm not a VB.net programmer, however I do code in VB6 and VBA on a daily basis and there are certain things that are similar.

Take a look over here---->http://www.programmersheaven.com/2/VB-NET-School

Ad

  • 0
  Adaytay said:
Hi Rich,

It should definitely be technically possible to do what you want, yes.

I'm not a VB.net programmer, however I do code in VB6 and VBA on a daily basis and there are certain things that are similar.

Take a look over here---->http://www.programmersheaven.com/2/VB-NET-School

Ad

Cheers mate. will take a look at home some point.

Any other suggestions from anyone else?

Cheers,

Rich

  • 0

Rich

Let me give some advice that was given to me, and I found worked FOR ME. Ditch Visual Basic - you are learning a new language so take the opportunity to use C# instead (some people prefer it).

Post your VBS (rename to something else) and also a breakdown of what it does.

Cheers

  • 0
  njlouch said:
Rich

Let me give some advice that was given to me, and I found worked FOR ME. Ditch Visual Basic - you are learning a new language so take the opportunity to use C# instead (some people prefer it).

Post your VBS (rename to something else) and also a breakdown of what it does.

Cheers

Ok, here is the vbs script, without the real username and password for our desktop admin:

Hint=MsgBox("To use this program you need to input the program location in the next screen and NOT THE SHORTCUT LOCATION! If you are unsure of the software location, then right click the programs shortcut and select properties, then copy the target information and paste it in the next screen. Make sure you remove any quotation marks otherwise this program will not work!", vbOkOnly+vbInformation, "Runas")

Location=Inputbox("Please type the location of the file you wish to run below, then press OK.", "Runas")

If IsEmpty(Location) Then

Wscript.Quit

End If

Confirm=MsgBox("You entered the following location:" & vbCrLf & vbCrLf & Location & vbCrLf & vbCrLf & "Click ok to run the file, or cancel to re-type the location.", vbOkCancel+vbInformation, "Runas")

If Confirm=vbOk Then

Dim oShell

set oShell= Wscript.CreateObject("WScript.Shell")

oShell.Run "runas /noprofile /user:administrator " & chr(34) & Location & chr(34)

WScript.Sleep 100

oShell.Sendkeys "password here~"

Wscript.Quit

Else Confirm=vbCancel

Location2=Inputbox("Please type the new location of the file you wish to run below, then press OK.", "Runas")

If IsEmpty(Location2) Then

Wscript.Quit

End If

Confirm2=MsgBox("You entered the following location:" & vbCrLf & vbCrLf & Location2 & vbCrLf & vbCrLf & "Click ok to run the file, or cancel to Exit the program.", vbOkCancel+vbInformation, "Runas")

If Confirm2=vbOK Then

set oShell= Wscript.CreateObject("WScript.Shell")

oShell.Run "runas /noprofile /user:administrator " & chr(34) & Location2 & chr(34)

WScript.Sleep 100

oShell.Sendkeys "password here~"

Wscript.Quit

Else Confirm2=vbCancel

Wscript.Quit

End If

End If

  • 0
  njlouch said:
Let me give some advice that was given to me, and I found worked FOR ME. Ditch Visual Basic - you are learning a new language so take the opportunity to use C# instead (some people prefer it).

Indeed, C# will give you a grounding in fundamental programming logic and also make you familiar with Object Oriented programming styles - so you can progress to C++, Java, PHP, or other such languages easier... (if you should so wish).

  • 0

This might save you some time

C#

http://www.codeproject.com/csharp/RunAs.asp

VB.NET

http://www.tek-tips.com/viewthread.cfm?qid=1235871

Edited by primortal
  • 0
  Endo. said:
Indeed, C# will give you a grounding in fundamental programming logic and also make you familiar with Object Oriented programming styles - so you can progress to C++, Java, PHP, or other such languages easier... (if you should so wish).

uh so does VB.NET, VB.NET is just a syntax change from C# its the same language besides syntax changes... uses the same objects and classes, same OOP approach, if you can code in VB.NET learning C# is easy, and vice versa... so saying ditch one is meaningless, if you know one you can pick up the other VERY quickly since they use all the same namespaces (if you leave out, and which you should, the legacy microsoft.visualbasic namespace, of which you can still use in C# if you want to)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • My home system is a 5800X (upgraded from 2700X) with a 7800 XT. I can't comment as to why you feel so strongly about the differences, but I have used both Windows 10 and 11 for literally thousands of hours each; I'd guess over 10,000 hours on Windows 10 and maybe half that on Windows 11. Earlier builds of Windows 11 had some pretty big UI lag issues, which did annoy me, but not enough to go back to Windows 10. 23H2 and forward have corrected all those issues for me and I have no complaints at all at this time. Let me clarify what I meant by "Windows 11 runs perfectly fine." I don't mean it is merely acceptable; I mean that I don't perceive a difference between it and Windows 10. I chose the word "fine" because I don't believe that either 10 or 11 are perfect in that area and both have the rare UI hiccup, but in my experience, their responsiveness is at the same level.
    • WinToUSB 9.9 by Razvan Serea WinToUSB allows you to install and run a fully-functional Windows on external hard drive, USB flash drive or Thunderbolt drive. It is so easy and efficient, with just 3 steps and a few minutes, you can create your first portable Windows 11/10/8/7 or Windows Server directly from an ISO, WIM, ESD, SWM, VHD, VHDX file or CD/DVD drive, or you can clone currently running Windows installation to USB or Thunderbolt drive as portable Windows. WinToUSB also supports creating Windows installation USB drive from Windows 11/10/8/7 and Windows Server installation ISO, with it you can install Windows from the USB drive easily. Note: The WinToUSB Free Edition is solely intended for non-commercial, private, and personal use on home computers. It should be noted that technical support is not available for the free edition. Use of WinToUSB Free Edition within any organization or for commercial purpose is strictly prohibited. WinToUSB key features include: Creation of Windows To Go from ISO, WIM, ESD, SWM, VHD(X) or DVD drive.Improved Clone Windows 11/10/8/7 to USB/Thunderbolt drive as portable Windows. Creation of Windows To Go on Non-Certified Windows To Go USB drive. Encrypt Windows To Go with BitLocker to keep your data safe. Creation of Windows installation and bootable WinPE USB drive with BIOS & UEFI support. Download Official Windows 11/10/8.1 ISO file from Microsoft. Use any edition of Windows 11/10/8/7 and Windows Server 2022/2019/2016/2012/2010 to create Windows To Go USB drive. Windows To Go (Portable Windows) Creator WinToUSB allows you to install & run fully-functional Windows on an external HDD/SSD, USB flash drive or Thunderbolt drive, which means you can carry the portable Windows drive to anywhere and use it on any computer. Faster installation and cloning speed compared to competing products Support any edition of Windows 11/10/8/7 and Windows Server Creation of Windows To Go from ISO, WIM, ESD, SWM, VHD(X) or CD/DVD drive Clone currently running Windows to USB/Thunderbolt drive Creation of Windows To Go on Non-Certified Windows To Go drive Create BitLocker encrypted Windows To Go Workspace Create portable Windows for Intel-based Mac computers Support for creating VHD(X)-based Windows To Go Windows Installation USB Creator WinToUSB releases a feature called "Windows Installation USB Creator" which allows you to create a Windows installation USB drive from a Windows 11/10/8/7/vista/2022/2019/2016/2012/2008 installation ISO file with a few simple steps, with this feature you can create a bootable Windows installation USB drive to install Windows on both Traditional BIOS and UEFI computers by using the same USB drive. Bypass Windows 11 system requirements (TPM 2.0, Secure Boot, Minimum hardware and Microsoft account) Install Windows on both BIOS and UEFI computers by using the same USB drive Windows PE Bootable USB Creator This feature allows you to create a bootable Windows PE USB drive, it can help you transfer the contents of a Windows PE ISO file to a USB drive and make the USB drive bootable, and this feature supports the creation of a bootable WinPE USB driver that supports both Traditional BIOS and UEFI computers. WinToUSB 9.9 changelog: Added option to disable BitLocker automatic drive encryption when creating Windows installation USBs Fixed bug: setup.exe cannot bypass the Windows 11 system requirements Fixed bug: Cloned Windows ARM64 cannot start properly Fix other minor bugs Download: WinToUSB 9.9.0 | 28.7 MB (Freeware) Links: Home Page | Free vs Pro Comparison | Screnshots Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Maybe you don't realize this...but everything you said agreed with me. Yes, many tech outlets reported on Ryzen 9000 issues prior to 24H2, which I already addressed, and as I already said, that issue only existed for a few short months. Ryzen 9000 was released the same quarter of 2024 as 24H2. So again...months, not years. I also already said 24H2 showed some minor improvements on older Ryzen CPU. The article you posted agrees with me, and even says the improvements were only 3-5%, which is even more petty an amount than I estimated. If you want to fuss on the 3-5% numbers, then yes, I will grant you that was an issue for an extended amount of time. In my opinion, that is such a small amount it isn't worth fussing over, but you are welcome to a different option. However, if that was your point, then you didn't make that point in good faith, because you highlighted Ryzen 9000 so much, which had a FAR bigger and FAR shorter issue, it's really a very different conversation.
    • The vast majority of users do not care which iOS version they're using. They don't even know or bother updating to the latest version, unless they see the prompt. The version numbers is more for the power users and I don't think Apple renamed their OS for them.
  • Recent Achievements

    • Week One Done
      abortretryfail earned a badge
      Week One Done
    • First Post
      Mr bot earned a badge
      First Post
    • First Post
      Bkl211 earned a badge
      First Post
    • One Year In
      Mido gaber earned a badge
      One Year In
    • One Year In
      Vladimir Migunov earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      495
    2. 2
      snowy owl
      251
    3. 3
      +FloatingFatMan
      251
    4. 4
      ATLien_0
      228
    5. 5
      +Edouard
      191
  • Tell a friend

    Love Neowin? Tell a friend!