If it's local you could define your own file types. For instance, vb1 and vb2. If you look in the Registry under HKCR\VBSFile you should see a DefaultIcon key, an Open key and an Open2 key. Open is generally wscript and Open2 is generally cscript. With that info. you have enough to define your own file-type keys and icons for each engine.
> 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
> If it's local you could define your own file > types. For instance, vb1 and vb2. If you > look in the Registry under HKCR\VBSFile you > should see a DefaultIcon key, an Open key > and an Open2 key. Open is generally wscript > and Open2 is generally cscript. With that info. > you have enough to define your own file-type > keys and icons for each engine.
>> 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 ?
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.
> 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
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.
> 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
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)
>> 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
> 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)
> 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
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