Jump to content

simple script DOES NOT work


Recommended Posts

I want to make a script that automatically change my office key.

:) here is my script but it does not work:

#RequireAdmin

If @OSArch = "X64" Or "IA64" Then

$key = "HKLM64"

Else

$key = "HKLM"

EndIf

$var = RegRead($key & "SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot", "Path")

runWait('cscript.exe '$var & "ospp.vbs /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB"'', '', @SW_HIDE)

Exit

it does not work..

if I open CMD and run

cscript "%PROGRAMFILES%\Microsoft Office\Office14\ospp.vbs" //b /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB

it works.

the "Path" value in the registry is "C:\Program Files\Microsoft Office\Office14\"

(mods the KEY is microsoft betatrial key, so it's legit so don't remove this thread)

I have also tried this:

runWait(@COMSPEC & " /c " & ""$var"\ospp.vbs /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB", @SW_HIDE)

runWait(@comSpec & ' /c cscript.exe '$var & "ospp.vbs /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB"'', '', @SW_HIDE)

runWait('cscript.exe "'$var'\ospp.vbs" /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB', @SW_HIDE)

ShellExecute($var & "ospp.vbs", "/inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB", "", "", @SW_HIDE)

but it does not work.

I get "Error:Error in expression Line" in that line.

please help me.

B):D;):):(

Link to comment
Share on other sites

Maybe this works?

#RequireAdmin
$key = "HKLM"
If StringInStr(@OSArch,"64") then $key = "HKLM64"
$var = RegRead($key & "\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot", "Path")
runWait("cscript.exe """ & $var & "\ospp.vbs"" //b /inpkey:KEY",$var, @SW_HIDE)
Exit
Edited by KaFu
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...