Hi,
I wanted to know how to run dos commands using javascript.
Also i need to run a batch file with two command line arguments. These commandline arguments are variables.
Thanks
Raghu
12 20416
Hi,
I was able to run a batch file using vb script. -
Set WshShell = CreateObject("WScript.Shell")
-
WshShell.Run"setcpath2.bat"
-
i need to pass command line arguments to the batch file. This is stored in variables.
Thanks,
Raghu
See if this thread offers any help.
I trust you know that this will not be possible with JavaScript, but you could use ActiveX/ vbscript for an IE-only solution with the correct security settings.
Thanks for the reply. Is it possible to pass values to the batch file from vb script?
The values are basically the path that needs to be set that varies.
I'm not sure, but could you not include it within the string (separated by a space)?
You my also want to try asking the Visual Basic forum.
Hi,
I need to pass two strings to a batch file using vb script. I am able to call the batch file using wshShell.Run, but am unable to pass any arguments. -
Dim WshShell
-
Set WshShell = CreateObject("WScript.Shell")
-
dim pos
-
pos=InstrRev(full,"\")
-
dim fpath
-
dim pl
-
pl= Len(full)-pos-1
-
fpath= Left(full,pl)
-
dim fname
-
dim flen
-
flen= Len(full)-pos
-
fname=Right(full,flen)
-
Alert(fpath)
-
Alert(fname)
-
WshShell.Run "setcpath2.bat"
-
I need to pass fname and fpath as the two arguments to the batch file.
I would appreciate any help with this.
Raghu
Thanks for your help. Appreciate it.
Raghu
Hi,
I have a similar query. How do i pass a variable as the argument to the batch file. -
var shell = new ActiveXObject("WScript.Shell");
-
var fname;
-
var fpath;
-
shell.run( '"setcpath2.bat" fpath fname' , 1, true );
-
The two arguments are fpath and fname. I need the values stored in the variables to be passed as arguments.
Thanks,
Raghu
I assume you'd use something like: -
var shell = new ActiveXObject("WScript.Shell");
-
var fname = ... // set these to something
-
var fpath = ...
-
shell.run( '"setcpath2.bat" ' + fpath + ' ' + fname, 1, true );
-
Thanks a ton!!! It works.
Appreciate it.
Raghu
You're welcome. Post again if you have any more questions and we'll be glad to help.
Split and merged posts from Pass Parameter to .exe thread, so that question and answer appears in one thread.
MODERATOR
Sign in to post your reply or Sign up for a free account.
Similar topics
by: David Carroll |
last post by:
I'm at my wits end with this silly thing. I'm new to python, so please
excuse my impending ignorance ;). I am trying to execute a command, and
get the output back into a string variable. Here's...
|
by: Moosebumps |
last post by:
So, after reading some messages about os.system, and looking at the popen
stuff and trying it a bit, I still have not found a way to keep a command
window open for several commands (on Windows...
|
by: Sir_Scriptor |
last post by:
Hi, I am trying to understand Batch files for logging Text. I have a general understanding, but I am little lost on some of the command strings I keep seeing. I went out and Bought Microsoft Windows...
|
by: Dennis Gaida |
last post by:
Hi there,
I want to upload some exported reports to a FTP Server, for this I
use a command line FTP utility.
My Database sits in C:\Documents and Settings\Dennis\My
Documents\Database
The FTP...
|
by: Shooter4Life8 |
last post by:
Hi, I am having trouble figureing out the best way to open a command
prompt then write lines to it in VB.NET. Currently I have this code,
but it execute's too fast I think because
Dim psi As...
|
by: gopal |
last post by:
static void Main(string args)
{
....
....
}
I have an EXE now. I am now giving one of the arguments
as
|
by: tcurdts |
last post by:
I think what I’m trying to do is very basic but I’m a rank beginner and I’m stuck. I’m using Python 2.4.1 on WindowsNT. I’ve installed UnxUtils, which includes the tar commands for Windows.
...
|
by: stemp1ar |
last post by:
I am wondering if it possible to open a single process and run
multiple commands on that process and check standard error and
standard out after each command? Has anyone done something similar...
|
by: JOHNSHELL08 |
last post by:
sir , i saw many batch file which contains the first line
@ ECHO OFF
WHAT THIS LINE DOES & WHAT ITS IMPORTANCE IN BATCH FILE.
AND ALSO TELL ME.................
How can we execute a single...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |