zoukankan      html  css  js  c++  java
  • 手机探索者开发实录—制作MobileX插件的安装包

    手机探索者开发实录—制作MobileX插件的安装包

    转载时请注明出处和作者联系方式
    作者联系方式:李先静 <xianjimli at hotmail dot com>

    制作安装包有很多方法,但我喜欢最简单的方法,所以选择了iexpress。它是Windows自带的,简单易用,当然功能也很简单,它把所有文件打包成一个EXE文件,运行时解压到一个临时目录,然后运行指定的程序,其它的事情都要自己做了。

    VBScript也是我很喜欢的脚本,虽然我一年中也难得用它一次。但它非常容易上手,也不需要在IDE里开发,而且功能强大,操作COM组件真是得心应手。所以我决定用VBScript作为安装脚本,让安装程序在解压完成时调用。Install.vbs内容如下:

    1. 'Mobile Explorer for MobileX installer

    2. set shl = CreateObject("WScript.Shell")
    3. set fso = CreateObject("Scripting.FileSystemObject")
    4. set sha = CreateObject("Shell.Application")

    5. install_path = shl.ExpandEnvironmentStrings("%ProgramFiles%") + "/mobile_me"
    6. system_root = shl.ExpandEnvironmentStrings("%SystemRoot%") + "/system32"

    7. if fso.FolderExists(install_path) then
    8.     fso.DeleteFolder(install_path)
    9. end if

    10. fso.CreateFolder(install_path)

    11. set folder = fso.GetFolder("./")
    12. set files = folder.files

    13. for each file in files
    14.     file.Copy(install_path + "/" + file.name)
    15. next

    16. filenames = Split("libexpat.dll,mehost.dll,mobilex_me.dll"",")
    17. for x=0 to UBound(filenames)
    18.     set file = fso.GetFile(install_path + "/" + filenames(x))
    19.     file.Copy(system_root + "/" + filenames(x))
    20. next
    21. sha.ShellExecute  install_path + "/WceRndis.inf",  """""install", 1
    22. sha.ShellExecute  install_path + "/WceIS.inf""""""install", 1
    23. sha.ShellExecute  install_path + "/wceusbsh.inf""""""install", 1
    24. shl.Run "regsvr32 """ + system_root + """/mobilex_me.dll", , true


    uninstall.vbs:

    1. 'Mobile Explorer for MobileX uninstaller

    2. set shl = CreateObject("WScript.Shell")
    3. set fso = CreateObject("Scripting.FileSystemObject")

    4. install_path = shl.ExpandEnvironmentStrings("%ProgramFiles%") + "/mobile_me"
    5. system_root = shl.ExpandEnvironmentStrings("%SystemRoot%") + "/system32"

    6. shl.Run "regsvr32 /u """ + system_root + """/mobilex_me.dll", , true

    7. On   Error   Resume   Next
    8. if fso.FolderExists(install_path) then
    9.     fso.DeleteFolder(install_path)
    10. end if

    11. filenames = Split("libexpat.dll,mehost.dll,mobilex_me.dll"",")
    12. for x=0 to UBound(filenames)
    13.     filename=system_root + "/" + filenames(x)
    14.     if fso.FileExists(filename) then
    15.         fso.DeleteFile(filename)
    16.     end if
    17. next
    ~~end~~

  • 相关阅读:
    URAL 1998 The old Padawan 二分
    URAL 1997 Those are not the droids you're looking for 二分图最大匹配
    URAL 1995 Illegal spices 贪心构造
    URAL 1993 This cheeseburger you don't need 模拟题
    URAL 1992 CVS
    URAL 1991 The battle near the swamp 水题
    Codeforces Beta Round #92 (Div. 1 Only) A. Prime Permutation 暴力
    Codeforces Beta Round #7 D. Palindrome Degree hash
    Codeforces Beta Round #7 C. Line Exgcd
    Codeforces Beta Round #7 B. Memory Manager 模拟题
  • 原文地址:https://www.cnblogs.com/zhangyunlin/p/6167618.html
Copyright © 2011-2022 走看看