BoogY Posted September 25, 2009 Share Posted September 25, 2009 Hello there me agen can somone translate the script to autoit ? Const SW_NORMAL = 1 strComputer = "." 'strCommand = "C:\WINDOWS\MS\SMS\clicomp\hinv\hinv32.exe" strCommand = "calc.exe" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") 'Configure the Notepad process to show a window Set objStartup = objWMIService.Get("Win32_ProcessStartup") Set objConfig = objStartup.SpawnInstance_ objConfig.ShowWindow = SW_NORMAL ' Create Notepad process Set objProcess = objWMIService.Get("Win32_Process") intReturn = objProcess.Create _ (strCommand, Null, objConfig, intProcessID) If intReturn <> 0 Then Wscript.Echo "Process could not be created." & _ vbNewLine & "Command line: " & strCommand & _ vbNewLine & "Return value: " & intReturn Else Wscript.Echo "Process created." & _ vbNewLine & "Command line: " & strCommand & _ vbNewLine & "Process ID: " & intProcessID End If i did 'it like this : Const $SW_NORMAL = 1 $strComputer = $TFS $strCommand = "C:\WINDOWS\MS\SMS\clicomp\hinv\hinv32.exe" $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") ;Configure the Notepad process to show a window $objStartup = $objWMIService.Get("Win32_ProcessStartup") $objConfig = $objStartup.SpawnInstance_ $objConfig.ShowWindow = $SW_NORMAL ;Create Notepad process $objProcess = $objWMIService.Get("Win32_Process") $intReturn = $objProcess.Create($strCommand, "", $objConfig, $intProcessID) If $intReturn <> 0 Then MsgBox(0,"Process could not be created." & _ @LF & "Command line: " & $strCommand & _ @LF & "Return value: " & $intReturn) Else MsgBox(0,"Process created." & _ @LF & "Command line: " & $strCommand & _ @LF & "Process ID: " & $intProcessID) EndIf Is that corect ? Link to comment Share on other sites More sharing options...
Andreik Posted September 25, 2009 Share Posted September 25, 2009 If you tried and work is corect. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
BoogY Posted September 25, 2009 Author Share Posted September 25, 2009 no its not working this line of code gives an error : $intReturn = $objProcess.Create($strCommand, "", $objConfig, $intProcessID)because of the "" Link to comment Share on other sites More sharing options...
BoogY Posted September 25, 2009 Author Share Posted September 25, 2009 is there any alternatif on qutoit for NULL ?! Link to comment Share on other sites More sharing options...
Juvigy Posted September 25, 2009 Share Posted September 25, 2009 It is because you need "NULL" and it is not always same as "". Try this one courtesy of Dale: Local $oVBS = ObjCreate("ScriptControl") $oVBS.language = "VBScript" Global Const $Nothing = $oVBS.eval("Nothing") $oVBS = $Nothing And then replace "" with $Nothing. Link to comment Share on other sites More sharing options...
trancexx Posted September 25, 2009 Share Posted September 25, 2009 Description for that parameter says: "if NULL, the new process will have the same path as the calling process". That means you can replace NULL with @ScriptDir macro, besides Juvigy's suggestion. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now