Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 12-27-2015, 11:03 AM   #1
Beta Member
 
Join Date: Jul 2015
Posts: 2
Default Make .bat and .vbs work together!

I have a program and i like the batch format but i want for the user to input some numbers in the friendly vbs format. Is there any possible way to send data from a .vbs file to a batch file? If not is it possible to make a batch popup? Or maybe running vbs code in a batch file?
THANKYOU IN ADVANCE


Sent from my iPhone using Computer Forums
__________________

scgryan@gmail.com is offline   Reply With Quote
Old 12-27-2015, 11:07 AM   #2
Fully Optimized
 
Draygoes's Avatar
 
Join Date: Nov 2014
Location: United States
Posts: 1,653
Default Re: Make .bat and .vbs work together!

A batch file is a set of commands. You will not be able to insert data that way. Try C#, and learn your way around RAM info.
__________________

__________________
Will have a youtube channel up soon. Link will be here if I remember.
Draygoes is offline   Reply With Quote
Old 12-27-2015, 11:07 AM   #3
Beta Member
 
Join Date: Jul 2015
Posts: 2
Default Re: Make .bat and .vbs work together!

Wow fast reply


Sent from my iPhone using Computer Forums
scgryan@gmail.com is offline   Reply With Quote
Old 12-27-2015, 11:13 AM   #4
Fully Optimized
 
Draygoes's Avatar
 
Join Date: Nov 2014
Location: United States
Posts: 1,653
Default Re: Make .bat and .vbs work together!

Did that help?
__________________
Will have a youtube channel up soon. Link will be here if I remember.
Draygoes is offline   Reply With Quote
Old 12-27-2015, 12:38 PM   #5
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 7,999
Default Re: Make .bat and .vbs work together!

you can send "arguments" to any file (including batch files)
to invoke a batch file from vbs use code like this:
Code:
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "c:\batch\test.cmd"
you then read the arguments from the batch file as %1 %2 etc up to nine.

Code:
@echo off
echo hello %1
save that as hello.cmd and run with the argument root.

c:\>hello.bat root

and it'll say "hello root"

you can pass any argument you like.
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 12-27-2015, 12:52 PM   #6
Fully Optimized
 
Draygoes's Avatar
 
Join Date: Nov 2014
Location: United States
Posts: 1,653
Default Re: Make .bat and .vbs work together!

Well, I learned somthing new today. Thank you Root.
I will say that it defeats the reason though. The user wants to pass commands. Your method (which works) seems more complicated then it needs to.

You can send any "argument" to the command prompt, but that does not help with an already executed batch file. If I am wrong, please correct me but I think that is what they where asking about.
__________________
Will have a youtube channel up soon. Link will be here if I remember.
Draygoes is offline   Reply With Quote
Old 12-28-2015, 06:33 PM   #7
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 7,999
Default Re: Make .bat and .vbs work together!

Quite right,

I should have read the question properly.

The code I wrote expects you to get all your variables up front, either entered as arguments when launching the batch file, or by a series of prompts by a vbs that are then used to launch the batch file with arguments...

This code will wait for you to enter a variable and store it as such.
Code:
Set /p name="What is your name? "
Echo %name
What you should notice about this code is:
There is no error checking. No type checking, no provision for spaces or lack of them, etc...

Batch files can be useful, but generally only in the confines of getting something done that you are needing to do again and again (eg a batch process)...

It's not a good language to write things that you want to use long term or release or use to support something long term..,
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 04:42 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0