Jump to content

Can I write a single line cscript/wscript, a la perl, instead of calli


Recommended Posts

Hello,

If you're familiar with Perl, it has a feature where you can run it in single line edit mode, which allows you to write the code out all in one line, instead of calling my_script.vbs, for example. Is there a way I can just execute code in a similar single line edit mode, to avoid calling an external file? I just want to write out a msgbox that displays to the user from a batch, and it seems unnecessary to create another file which just has "msgbox...". I'm open to other suggestions, if there's a way to have a pop-up window display to the user directly from a batch without using an external language like vbscript.

Thank you.

Update: I did find this site that has been of great help --> http://www.robvanderwoude.com/usermessages.php

I took this bit of code here:


> usermessage.vbs ECHO WScript.Echoˆ( "Multiple lines?" ˆ& vbCrLf ˆ& "OK..." ˆ)
WSCRIPT.EXE usermessage.vbs
DEL usermessage.vbs

And it works fine, but I was hoping to do something like this (pseudo-code):


WSCRIPT.EXE "WSCRIPT.Echo('This is pseudo code, to show I want to display a msgbox without calling an external script.')"

Link to comment
Share on other sites


from a batch without using an external language like vbscript.

Batch files don't do GUI, it's tech from the 1980's. vbscript, a far more modern (then again, we now have powershell too) and powerful tech can though. Your best bet is getting rid of the batch file part, and just using vbscript. Whatever the batch file does, vbscript (and pretty much any other scripting language) can easily do as well. Even using something external from a batch file (to popup a messagebox or similar) is kind of a pain anyway (e.g. getting result using errorlevel)

Link to comment
Share on other sites

I'm not sure that I fully understand what your intention is. However from my understanding it is possible to display a message box from the batch file without undertaking the process of creating a vbscript, running it, then deleting it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...