• 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

    • New fiscal year, this happens in companies all over.
    • Windows 11 reaches a new all-time high share among gamers by Taras Buria The results of the June 2025 Steam Hardware & Software Survey are now available on the official website, showing Windows 11's continuous growth among gamers and the steady decline of Windows 10 ahead of the end of support. Valve reports that in June 2025, the almost-four-year-old Windows 11 holds nearly 60% of all PC users on Steam. It currently has a market share of 59.84%, which is a 1.54-point increase over the May 2025 results. Windows 10 has 35.69% (-1.31 point), and 64-bit Windows 7 nearly went extinct—only 0.09% of all Steam users who participated in the survey reported using the operating system that Microsoft stopped supporting years ago (the latest Steam client also no longer works in Windows 7). With Microsoft offering Windows 10 users free security updates for one more year, the outgoing OS is expected to stick around for a while longer on the gaming market and among regular users as well. Worldwide, Windows 11 has nearly caught up to Windows 10, as StatCounter reported earlier. Overall, 95.67% of the survey participants use Windows on their gaming machines (+0.22 points). Linux is second with 2.57% (-0.12 points), and macOS is third with 1.76% (-0.09 points). On the hardware side, the most popular PC configuration has 16GB of RAM (43.05%), a 6-core CPU (29.50%), an Nvidia RTX 4060 Laptop graphics card (4.79%), 8GB of VRAM (33.92%), and a 1080p monitor (55.54%). In June, the laptop variant of the RTX 4060 became the most popular GPU on Steam, taking over the desktop RTX 3060 with its 4.42% market share. Speaking of GPUs, Nvidia holds an overwhelming 74.07% share, while AMD has 17.68%, and Intel is third with 7.88%. Intel remains the most popular CPU vendor with a 59.29% share, while AMD has 40.71%. You can find more stats on the official Steam Hardware and Software Survey here.
    • Does it mean that the game will have weapons now? If that is the case, I'm interested. Not having weapons does not make any sense, even if it changes the gameplay. In such a hostile environment the first thing anyone would do is get as much weapons as they could.
    • This DDR5-6400 CL36 32GB RGB RAM that supports both AMD and Intel is only $72 by Sayan Sen Recently, we covered several SSD deals, both internal and external. These include the Crucial X9 Pro and X10 Pro, the P310 2280, and the Samsung 990 EVO Plus. Meanwhile if you are looking for RAM to upgrade your desktop PC or build a new one, the PNY XLR8 Gaming EPIC-X RGB DDR5-6400 Kit can be your go-to choice as it is currently just $72 (purchase link down below). In terms of specs, this dual-RAM kit delivers 32GB of total DDR5 capacity (each module is 16GB) running at 3200 Hz to deliver 6400 MT/s (PC5-51200) at 1.4 volts. Pre-programmed Intel XMP 3.0 and AMD EXPO memory overclocking preset profiles mean you can fire up the kit to its rated speed with a simple BIOS tweak, rather than having to deal with manual timing adjustments. The CAS latency for this DDR5-6400 kit is 36, which is quite tight for a preset profile. Thermal performance is said to be stellar thanks to the aluminum heat spreader, which should help dissipate heat during extended gaming sessions. Additionally, the heat spreader is also said to feature an "embossed pennant design that enhances the overall look and complements the lighting of other components." Speaking of lighting, the included EPIC-X RGB model features ARGB LEDs diffused through a geometric polymer light pipe and allows syncing via Asus Aura Sync, Gigabyte RGB Fusion, MSI Mystic Light, or ASRock Polychrome Sync software. Get the PNY RAM at the link below: PNY XLR8 Gaming Epic-X RGB™ 32GB (2x16GB) DDR5 RAM 6400 CL36-48-48-104 Desktop Memory Kit (MD32GK2D5640036XRGB): $72.24 (Sold and Shipped by Amazon US) (MSRP: $109.99) This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
  • Recent Achievements

    • First Post
      loose_observer earned a badge
      First Post
    • Week One Done
      BeeJay_Balu earned a badge
      Week One Done
    • Week One Done
      filminutz earned a badge
      Week One Done
    • Reacting Well
      SteveJaye earned a badge
      Reacting Well
    • One Month Later
      MadMung0 earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      446
    2. 2
      ATLien_0
      161
    3. 3
      +FloatingFatMan
      148
    4. 4
      Nick H.
      65
    5. 5
      +thexfile
      62
  • Tell a friend

    Love Neowin? Tell a friend!