Comment on appel un script dans un script avec des paramètres ?
J'ai
Code:
1 2
| Set WSHShell = CreateObject("WScript.Shell" )
WSHShell.Run "wscript \\server\NETLOGON\uo_test_script\monscript.vbs" |
Je voudrai envoyer deux paramètres
paramètre1 et paramètre2
Code:
WSHShell.Run "wscript \\server\NETLOGON\uo_test_script\monscript.vbs" /"paramètre1" /"paramètre2"
Est-ce bien cela ?
Pendant qu'on y est \O/, comment je recupère ses paramètres dans mon autre script.
Code:
1 2 3 4 5 6
| dim objnetwork
set objnetwork = wscript.createobject("wscript.network")
NomMachine = Objnetwork.ComputerName
rep = 1
WSHShell.Run "wscript \\server\NETLOGON\uo_test_script\monscript.vbs" /"nommachine" /"rep" |
me renvoie un erreur genre type incompatible string
Code:
WSHShell.Run "wscript \\server\NETLOGON\uo_test_script\monscript.vbs /nommachine /rep "
il me renvoit "/nommachien" et ensuite "/rep" via le script de recup qui est
Code:
1 2 3 4
| Set objArgs = WScript.Arguments
For I = 0 to objArgs.Count - 1
WScript.Echo objArgs(I)
Next |
Donc les varibles sont au bon endroit mais la synthaxe est mauvaise