Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8917839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:35:34+00:00 2026-06-15T05:35:34+00:00

How to execute VBS script in Java? What is he preferred way? I found

  • 0

How to execute VBS script in Java? What is he preferred way? I found in Internet so many advices, so I don’t know what is better…

1.

  Runtime.getRuntime().exec("cscript //NoLogo " + file.getPath());

2.

Runtime.getRuntime().exec("wscript.exe " + file.getPath())

3.

String script = "C:\\work\\selenium\\chrome\\test.vbs";
String executable = "C:\\windows\\...\\vbs.exe"; 
String cmdArr [] = {executable, script};
Runtime.getRuntime ().exec (cmdArr);

4.

Runtime.getRuntime().exec("cmd /c a.vbs");

5.

Desktop#open(new File("c:/a.vbs"));

And It is not all.

What kind of this to choose? I need to execute following script:

If Not IsObject(application) Then
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:35:35+00:00Added an answer on June 15, 2026 at 5:35 am

    VB scripts are typically executed using utility named cscript. I do not remember where this utility is located but it is definitely in path, so you can just run it directly like cscript yourscript.vbs. Now just use Runtime.exec() or ProcessBuilder from java.

    And for your convenience avoid using back slashes in java code. Use forward slash instead. It works in windows perfectly and do not require duplications like \\.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to copy and execute a .vbs script from my local machine to
I have a Java class that is using Runtime.exec() to execute a cscript process
I am attempting to execute a powershell script on 10.0.0.20 found at D:\path\script.ps1 with
I don't know VBScript, but recently I needed to write a script that had
Is it possible to execute a specific sub in a vbs file from a
I execute a lot of custom actions in my InnoSetup script in the CurStepChanged(ssPostInstall)
I'm trying to execute iisvdir from an ant script to clean and create a
Anyone know how to execute 64-bit vbscript code in vb.net? I need to execute
I have jumbled up a vbs script to compress files older than 7 days
I've been trying to use check_time.vbs to check the Windows time. Here's the script:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.