Question : unspecified number of parameters:pass an array of Objects

Hi,

I was running following program

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:

package Classes;

// Make methods that have unspecified number of parameters:pass an array of Objects 
 
 
public class vararg5 {
  public static void main(String args[]) {
    myMethod(new Object[] { "value 1", new Integer(2), "value n" });
  }

  public static void myMethod(Object parms[]) {
    for (int i = 0; i < parms.length; i++)
      System.out.println(parms[i]);
  }
} 
 

 


got output like
value 1
2
value n





Can you please let me know the flow, concept behind this program.
Any links, resources, sample code, suggestions highly appreciated. Thanks in advance

 


Answer : unspecified number of parameters:pass an array of Objects

you will have to make some modifications, basically, create one script to read the txt file, and for each line of it (each computer) make it execute psexec (with the password parameters and so on) with the execute of the second script.

Basically, to sum up.
1- Create a script that reads the txt file, and for each line executes a command (psexec)
2- Create a script that runs whatever you want on the computers.

Run the first script, which will execute psexec for every computer you want, getting the info you want.

As far as the execute function use '1
As far as the statement to execute per each line of the txt use 2'


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
'1

Function RunLocalCMD(argument)
	
	cmd = "%comspec% /k " & argument
	Set obj2Shell = CreateObject("WScript.Shell")
	obj2Shell.Run cmd
	Set obj2Shell = Nothing
	
End Function

2' 

RunLocalCMD("\\" & strComputer & " -u USERNAME -p PASSWORD cscript SECONDSCRIPT.VBS")
Random Solutions  
 
programming4us programming4us