I want indicate in the file .vbs the type of interpreteur for execute the
file (cscript or wscript)
i don't want use WSCRIPT //H:CScript //nologo //S
help me please
thank you very much
> Hello
>
> I want indicate in the file .vbs the type of interpreteur for execute the
> file (cscript or wscript)
> i don't want use WSCRIPT file://H:CScript file://nologo file://S
I want to define in the execute'file for execute in more machine
is-it possible ?
"mayayana" <mayaX...@rcXXn.com> a �crit dans le message de news:
uWEqhE0V...@TK2MSFTNGP04.phx.gbl...
> I want to define in the execute'file for execute in more machine
>
> is-it possible ?
Once the file is running that decision has already
been made, so I don't see how you'd do it. You'd
have to use the script to write a new script, then
shell to that script and quit.
As indicated, you must recognize which program was used, then re-run the
script. Assuming you want the script to use cscript, it will run in another
copy of the shell, so another console will be launched. I found this code:
===========
Dim strArgs, i, objShell
' Code to make sure program runs with cscript host program.
strArgs=""
If (Right(LCase(Wscript.Fullname), 11)= "wscript.exe") Then
For i = 0 To Wscript.Arguments.Count - 1
strArgs = strArgs & Wscript.Arguments(i) & " "
next
Set objShell=CreateObject("Wscript.Shell")
objShell.Run objShell.ExpandEnvironmentStrings("%comspec%") & _
" /k cscript.exe //nologo " & Wscript.ScriptFullname & " " & strArgs
Wscript.Quit
End If
' The actual VBScript program follows.
Wscript.Echo "Line 1"
Wscript.Echo "Line 2"
Wscript.Echo "Line 3"
Wscript.Echo "Line 4"
==========
In this example I used the /k switch to keep the console open so you can see
anything echoed to the screen. Otherwise, you can use the /c switch and the
new command window will just blink and you won't see anything, including
error messages. With the /k switch you see all messages, but you must enter
"exit" to close the new command window.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
The following code will allow you to force a script to always use CSCRIPT no
matter which host is default. Place it at the top of your script.
' Restart with CSCRIPT.vbs
' Written by Todd Vargo in Windows 98 on May 14, 2008
Set WshShell = CreateObject("WScript.Shell")
If InStr(Ucase(WScript.FullName), "WSCRIPT.EXE") Then
'Restart using CSCRIPT.EXE
WshShell.Run "CSCRIPT.EXE //nologo " & _
Chr(34) & Wscript.ScriptFullName & Chr(34)
Wscript.Quit
End If
Wscript.Echo "Host is " & WScript.FullName
WshShell.Popup "Script will close in 5 seconds.",5,"Done"
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
Thank you VERY much
"Todd Vargo" <tlv...@sbcglobal.netz> a �crit dans le message de news:
u3h77Z1V...@TK2MSFTNGP05.phx.gbl...
I Use this:
If LCase(Right(WScript.FullName, 11)) <> "cscript.exe" Then
WScript.Echo "Please use CScript to run this script"
WScript.Quit
End If
--
.::[ Hz ]::.