VMWARE Thin APP

VMWARE Thin APP

1,ThinAPP 基本使用教程

 

2,cmd 環境變量設置方法詳細解釋

cmd設置環境變量能夠方便咱們bat腳本的運行,可是要注意的是變量只在當前的cmd窗口有做用(局部生效),若是想要設置持久的環境變量須要咱們經過兩種手段進行設置:一種是直接修改註冊表,另外一種是經過個人電腦-〉屬性-〉高級,來設置系統的環境變量。 html

1查看當前全部可用的環境變量:輸入 set 便可查看。 java

2查看某個環境變量:輸入 "set 變量名"便可,好比想查看temp變量的值,即輸入 set temp windows

固然也可使用echo %temp% 網絡

3修改環境變量 :輸入 "set 變量名=變量內容"便可,好比將temp設置爲"d:\tempfile",只要輸入set temp="d:\tempfile"。注意,此修改環境變量是指用如今的內容去覆蓋之前的內容,並非追加。好比當我設置了上面的path路徑以後,若是我再從新輸入set temp="c",再次查看temp路徑的時候,其值爲"c",而不是"d:\tempfile""c" app

4設置爲空:若是想將某一變量設置爲空,輸入"set 變量名="便可。如"set path=" 那麼查看path的時候就爲空。注意,上面已經說了,只在當前命令行窗口起做用。所以查看path的時候不要去右擊"個人電腦"——"屬性"........ less

5給變量追加內容(不一樣於3,那個是覆蓋):輸入"set 變量名=%變量名%;變量內容"。如,爲temp添加一個新的路徑,輸入" set path=%path%;d:\tempfile"便可將d:\tempfile添加到path中,再次執行"set path=%path%;c:",那麼,使用set path語句來查看的時候,將會有:d:\tempfile;c:,而不是像第3步中的只有c: dom

環境變量詳細解釋 ide

1、查看當前可用的全部環境變量(=系統變量+用戶變量) 函數

set 工具

查看某個環境變量,如PATH

set PATH

添加環境變量,如xxx=aa

set xxx=aa

將環境變量(如xxx)的值置爲空

set xxx=

在某個環境變量(如PATH)後添加新的值(如d:\xxx

set PATH=%PATH%;d:\xxx

[]:以命令行方式對環境變量的操做只對當前窗口的應用有效!

2WindowsJAVA用到的環境變量主要有3個:JAVA_HOMECLASSPATHPATH

1JAVA_HOME指向的是JDK的安裝路徑,如x:\ j2sdk1.4.2,在這路徑下你應該可以找到binlib等目錄。設置方法:JAVA_HOME=c:\ j2sdk1.4.2

2PATH變量的做用
java
程序在運行時首先在path變量所定義的路徑去找java.exe,並以最早找到的爲準,若是安裝完j2sdk後不加設置,通常是C:\WINDOWS\system32目錄。
j2sdk1.4
(還有其它java開發工具如jbuilder8)在安裝後會將java.exe拷貝到C:\WINDOWS\system32目錄下,當執行java.exe時,須要裝載這個SDK下的一些文件。
j2sdk1.4在安裝完成後,C:\WINDOWS\system32下的java.exe在運行時會在C:\Program File\java\目錄下裝載必需的一些文件。但安裝j2sdk後通常會在PATH變量的最前面設置C:\ j2sdk1.4.2 \bin
當先安裝j2sdk1.4.2,後安裝jbuilder8等開發工具時,因爲jbuilder8java.exe在拷貝到C:\WINDOWS\system32時可能覆蓋了j2sdk1.4.2java.exe,那麼這時在運行的java.exe會到jbuilder8所在的目錄去裝載必需的一些文件。

3CLASSPATH環境變量的做用
告訴類裝載器到哪裏去尋找第三方提供的類和用戶定義的類。也可用使用JVM命令行參數-classpath分別爲應用程序指定類路徑,在-classpath中指定的類路徑覆蓋CLASSPATH環境變量中指定的值。

3、當機器內裝有多個SDK版本時,如何查看所用的是哪一個SDK

java -verbose

在出現的屏幕信息中能夠看出系統裝載的是哪一個目錄下的文件。

4Windows OS下設置PATH的方法

〔系統〕->〔環境〕-> 〔高級〕,在PATH變量的文本框中的最前面輸入C:\ j2sdk1.4.2\bin
或在命令行窗口中執行 set path=c:\j2sdk1.4.2\bin;%path%; 這樣在命令行窗口的任一路徑下均可以執行java.exe程序了。或設置PATH=%JAVA_HOME%\bin;%PATH%

5、對於CLASSPATH環境變量的設置方法要加倍當心,是由於之後你出現的莫名其妙80%以上的怪問題均可能是因爲CLASSPATH設置不對引發的。

CLASSPATH=.\;%JAVA_HOME%\lib\tools.jar

首先要注意的是最前面的".\;"——句點反斜槓分號。這個是告訴JDK,搜索CLASS時先查找當前目錄的CLASS文件。
Troubleshooting

編譯會出現如下狀況,看你是否真得都理解環境變量的設置,並能解決它。
[T1]error
java不是一個可運行的程序? 因爲沒有設置環境變量path
[T2] error
:不能打開某個目錄? 多是忽視了path環境變量中的目錄的設置順序。
[T3]Exception on thread "main" java.lang.DoClassDefFoundError:Test
沒有設置classpath的路徑。

cmd查看環境變量

1、查看當前全部可用的環境變量:輸入 set 便可查看。
2
、查看某個環境變量:輸入 "set 變量名"便可,好比想查看path變量的值,即輸入 set path
3
、修改環境變量 :輸入 "set 變量名=變量內容"便可,好比將path設置爲"d:\hacker.exe",只要輸入set path="d:\nmake.exe"。注意,此修改環境變量是指用如今的內容去覆蓋之前的內容,並非追加。好比當我設置了上面的path路徑以後,若是我再從新輸入set path="c",再次查看path路徑的時候,其值爲"c:",而不是"d:\nmake.exe";"c"
4
、設置爲空:若是想將某一變量設置爲空,輸入"set 變量名="便可。如"set path=" 那麼查看path的時候就爲空。注意,上面已經說了,只在當前命令行窗口起做用。所以查看path的時候不要去右擊"個人電腦"——"屬性"........
5
、給變量追加內容(不一樣於3,那個是覆蓋):輸入"set 變量名=%變量名%;變量內容"。如,爲path添加一個新的路徑,輸入" set path=%path%;d:\hacker.exe"便可將d:\hacker.exe添加到path中,再次執行"set path=%path%;c:",那麼,使用set path語句來查看的時候,將會有:d:\hacker.exe;c:,而不是像第3步中的只有c:

%ALLUSERSPROFILE% 局部 返回全部"用戶配置文件"的位置。
%APPDATA%
局部 返回默認狀況下應用程序存儲數據的位置。
%CD%
局部 返回當前目錄字符串。
%CMDCMDLINE%
局部 返回用來啓動當前的 Cmd.exe 的準確命令行。
%CMDEXTVERSION%
系統 返回當前的"命令處理程序擴展"的版本號。
%COMPUTERNAME%
系統 返回計算機的名稱。
%COMSPEC%
系統 返回命令行解釋器可執行程序的準確路徑。
%DATE%
系統 返回當前日期。使用與 date /t 命令相同的格式。由 Cmd.exe 生成。有關 date 命令的詳細信息,請參閱 Date
%ERRORLEVEL%
系統 返回最近使用過的命令的錯誤代碼。一般用非零值表示錯誤。
%HOMEDRIVE%
系統 返回鏈接到用戶主目錄的本地工做站驅動器號。基於主目錄值的設置。用戶主目錄是在"本地用戶和組"中指定的。
%HOMEPATH%
系統 返回用戶主目錄的完整路徑。基於主目錄值的設置。用戶主目錄是在"本地用戶和組"中指定的。
%HOMESHARE%
系統 返回用戶的共享主目錄的網絡路徑。基於主目錄值的設置。用戶主目錄是在"本地用戶和組"中指定的。
%LOGONSEVER%
局部 返回驗證當前登陸會話的域控制器的名稱。
%NUMBER_OF_PROCESSORS%
系統 指定安裝在計算機上的處理器的數目。
%OS%
系統 返回操做系統的名稱。Windows 2000 將操做系統顯示爲 Windows_NT
%PATH%
系統 指定可執行文件的搜索路徑。
%PATHEXT%
系統 返回操做系統認爲可執行的文件擴展名的列表。
%PROCESSOR_ARCHITECTURE%
系統 返回處理器的芯片體系結構。值: x86IA64
%PROCESSOR_IDENTFIER%
系統 返回處理器說明。
%PROCESSOR_LEVEL%
系統 返回計算機上安裝的處理器的型號。
%PROCESSOR_REVISION%
系統 返回處理器修訂號的系統變量。
%PROMPT%
局部 返回當前解釋程序的命令提示符設置。由 Cmd.exe 生成。
%RANDOM%
系統 返回 0 32767 之間的任意十進制數字。由 Cmd.exe 生成。
%SYSTEMDRIVE%
系統 返回包含 Windows XP 根目錄(即系統根目錄)的驅動器。
%SYSTEMROOT%
系統 返回 Windows XP 根目錄的位置。
%TEMP% and %TMP%
系統和用戶 返回對當前登陸用戶可用的應用程序所使用的默認臨時目錄。有些應用程序須要 TEMP,而其它應用程序則須要 TMP
%TIME%
系統 返回當前時間。使用與 time /t 命令相同的格式。由 Cmd.exe 生成。有關 time 命令的詳細信息,請參閱 Time
%USERDOMAIN%
局部 返回包含用戶賬戶的域的名稱。
%USERNAME%
局部 返回當前登陸的用戶的名稱。
%UserProfile%
局部 返回當前用戶的配置文件的位置。
%WINDIR%
系統 返回操做系統目錄的位置。

 

Setlocal 與 Endlocal 命令


開始與終止批處理文件中環境改動的本地化操做。在執行 Setlocal 以後所作的環境改動只限於批處理文件。要還原原先的設置,必須執行 Endlocal。達到批處理文件結尾時,對於該批處理文件的每一個還沒有執行的 Setlocal 命令,都會有一個隱含的 Endlocal 被執行。Endlocal結束批處理文件中環境改動的本地化操做。在執行Endlocal 以後所作的環境改動再也不僅限於批處理文件。批處理文件結束後,原先的設置沒法還原。

語法:

Setlocal {enableextension | disableextensions} {enabledelayedexpansion | disabledelayedexpansion}
...
Endlocal
...

若是命令擴展名被啓用,SETLOCAL 能夠接受{}中的可選參數,啓動或停用命令處理器擴展名及延緩環境變量擴展名。詳細信息,請參閱 CMD /? 和 SET /? 。
不管在 Setlocal 命令以前它們的設置是什麼,這些修改會一直保留到匹配的 Endlocal 命令。

示例:

@ECHO OFF
Echo Before Setlocal:
Set PATH
Pause
Setlocal
Rem reset environment var PATH
Set PATH=E:\TOOLS
Echo after Setlocal and reset PATH
Set PATH
Pause
Endlocal
Echo Recovery PATH by Endlocal
Set PATH

從上例咱們能夠看到環境變量PATH第1次被顯示得時候是系統默認路徑。被設置成了"E:\TOOLS"後顯示爲"E:\TOOLS"。但當 Endlocal 後咱們能夠看到他又被還原成了系統的默認路徑。但這個設置只在該批處理運行的時候有做用。當批處理運行完成後環境變量PATH將會還原。

技巧:

若是有一個參數,SETLOCAL 命令將設置 ERRORLEVEL 的值。若是有兩個有效參數中的一個,該值則爲零。用下列技巧,您能夠在批腳本中使用這個來決定擴展名是否可用:

VERIFY OTHER 2>nul
SETLOCAL ENABLEEXTENSIONS
IF ERRORLEVEL 1 echo Unable to enable extensions

這個方法之因此有效,是由於在 CMD.EXE 的舊版本上,SETLOCAL不設置 ERRORLEVEL 值。具備不正確參數的 VERIFY 命令將ERRORLEVEL 值初始化成非零值。

 

 

3,系統環境變量和用戶環境變量在註冊表的位置

系統環境變量:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\Environment\
用戶環境變量:
HKEY_CURRENT_USER\Environment
如何使用程序設置環境變量,或者獲取環境變量值呢?
首先咱們設置用戶環境變量,
變量名爲:stf 
變量值爲:aizuguoairenmin
而後重啓VS,添加以下代碼:
#include "windows.h"
#include "tchar.h"
int _tmain()
{
    TCHARbuf[1024] = L"0";
   GetEnvironmentVariable(L"stf", buf, sizeof(buf));//
獲取變量名爲stf的變量值
    DWORD dw =GetLastError(); //
判斷是否獲取stf對應的變量值
    if (0 !=dw)
    {
       return-1;
    }
   _tprintf(L"%s\n", buf);

   SetEnvironmentVariable(L"stf", L"China");//
從新設置變量名爲stf的變量值爲China
   GetEnvironmentVariable(L"stf", buf, sizeof(buf));//
查看獲取的變量名是否修改爲功
   _tprintf(L"%s\n", buf); //
輸出修改後的結果
    return0;
}

運行結果:
aizhuguoairenmin
China
請按任意鍵繼續. . .

須要注意的是:這裏經過程序修改的環境變量值,在系統中仍是顯示以前的結果,那個由於SetEnvironmentVariable函數的修改只在當前進程有效。

 

4,vbscript Registry 註冊表操做實現代碼(讀寫刪除)

VBScript Code: 

複製代碼代碼以下:


' Create a WSH Shell object: 
Set wshShell = CreateObject( "WScript.Shell" ) 

' Create a new key: 
wshShell.RegWrite "HKCU\TestKey\", "" 

' Create a new DWORD value: 
wshShell.RegWrite "HKCU\TestKey\DWordTestValue", 1, "REG_DWORD" 

' Create a new subkey and a string value in that new subkey: 
wshShell.RegWrite "HKCU\TestKey\SubKey\StringTestValue", "Test", "REG_SZ" 

' Read the values we just created: 
WScript.Echo "HKCU\TestKey\DWordTestValue = " _ 
& wshShell.RegRead( "HKCU\TestKey\DWordTestValue" ) 
WScript.Echo "HKCU\TestKey\SubKey\StringTestValue = """ _ 
& wshShell.RegRead( "HKCU\TestKey\SubKey\StringTestValue" ) & """" 

' Delete the subkey and key and the values they contain: 
wshShell.RegDelete "HKCU\TestKey\SubKey\" 
wshShell.RegDelete "HKCU\TestKey\" 

' Note: Since the WSH Shell has no Enumeration functionality, you cannot 
' use the WSH Shell object to delete an entire "tree" unless you 
' know the exact name of every subkey. 
' If you don't, use the WMI StdRegProv instead. 

' Release the object 
Set wshShell = Nothing 


VBScript編寫的WSH程序文件的擴展名爲.vbs,該腳本程序在窗口界面是由wscript.exe文件解釋執行的,在字符界面是由cscript.exe文件解釋執行的,命令格式爲:cscript filename.vbs 
  
建立對象 

  用VBScript修改註冊表,必須先建立一個能於操做系統溝通的對象,再利用該對象的各類方法對註冊表進行操做,建立這個對象的方法和格式以下
Dim OperationReGIStry 
Set OperationRegistry=WScript.CreateObject("WScript.Shell") 
  上述這些代碼就建立了一個能與操做系統溝通的對象OperationRegistry 
對象的方法 
有了以上這個對象,並不等於就能立刻對註冊表進行操做,咱們還必須弄清該對象對註冊表進行操做的幾種重要方法
   1.對註冊表的讀操做RegRead 
   2.對註冊表的寫操做RegWrite 
   3.對註冊表的刪操做RegDelete 

   補充一點,WSH還有兩個通用的方法
   WScript.Echo()用來顯示一串文本信息,至關於VB中的MsgBox() 
   Wscript.Quit()用來退出VBScript程序。 
  
方法的參數 
  對於以上三種操做RegRead,RegWrite,RegDelete都須要帶參數進行,而且這些操做的參數的個數和形式又不盡相同,下面我就把它們的一個共同且必不可少的參數講一下
該參數可稱做是"路徑參數",它包括根鍵,主鍵路徑和鍵值,各部分表示的方法以下
根鍵
  根鍵有兩種表示方法。 
  方法一:直接用它在註冊表中的字符串來表示,如: 
  HKEY_CLASSES_ROOTHKEY_CURRENT_USER 
  方法二:用縮寫的四個字母來表示,前兩個爲HK,後兩個即爲根鍵單詞的首字母。如: 
  根鍵HKEY_CLASSES_ROOT表示爲:HKCR, 根鍵HKEY_CURRENT_USER可表示爲:HKCU等。 
主鍵路徑
  主鍵路徑就是目標鍵在註冊表中的主鍵位置,各個主鍵之間用"\"符分隔開。如:"Software\Microsoft\Windows\CurrentVersion\Policies\" 
  鍵值
  鍵值參數直接接在主鍵路徑以後。例如一個完整的路徑以下所示: 
  "HKCR\Software\Microsoft\Windows\CurrentVersion\Policies\NoRun" 
  
方法詳解 

  1RegRead操做詳解 

  讀操做RegRead主要是用來讀取註冊表中主鍵的默認值或鍵值的數據,咱們能夠將讀得的數據送到相應的變量中,再利用VB中的MsgBox()函數將該數據顯示出來,這就達到了讀取註冊表中數據的目的(也能夠利用對象OperationRegistry的方法Popup()將讀取的數據送至屏幕), 例如

複製代碼代碼以下:


   'read.vbs(將如下代碼存爲read.vbs文件
   Dim OperationRegistry 
   Set OperationRegistry=WScript.CreateObject("WScript.Shell") 
   Dim Read_Data1,Read_Data2 
   Read_Data1=OperationRegistry.RegRead("HKCR\.xxf\") 
   '讀取根鍵HKEY_CLASSES_ROOT之下的.xxf主鍵的默認值,並將該數據送至變量Read_Data1 
   Read_Data2=OperationRegistry.RegRead("HKCR\.xxf\value") 
   '讀取.xxf主鍵之下的value鍵值的數據,並將該數據送至變量Read_Data2 
   MsgBox("Default="&Read_Data1&" value="&Read_Data2) 
   '將讀取的數據顯示出來 



  2RegWrite操做詳解 

  寫操做RegWrite主要是用來在註冊表中新建主鍵或鍵值,並要賦予給它們一個初始值,該操做一樣能夠對註冊表中以存在的主鍵或鍵值進行數據的修改,所以寫操做的參數結構就比讀操做要複雜一些,它不只要路徑參數,還要一個初始值和類型參數

  先來看初始值參數,該參數對於寫操做來講是必不可少的,它能夠爲空(null)但卻不能省掉。在新建主鍵時,初始值參數就賦給了該主鍵的默認值,在新建鍵值時,初始值參數就成了新建鍵值的初始數據.而初始值的類型,則是由類型參數決定的.類型主要有如下三種
(1)REG_SZ:
字符型.該類型爲缺省類型 
  (2)REG_DWORD:雙字節型
  (3)REG_BINARY:二進制型

  以上三種類型第1種和第2種用得最多,3種類型在某些場合能夠用第2種加以替代,這三種類型的賦值方法以下
  對於REG_SZ:直接用字符串賦予,"text","string" 
  對於REG_DWORD型和REG_BINARY型則有兩種賦值方式 

  i)直接用十進制的數表示,如:01
  ii)用十六進制的數表示,如:0x12,0xff. 看例

複製代碼代碼以下:


'write.VBs 
Dim OperationReGIStry 
Set OperationRegistry=WScript.CreateObject("WScript.Shell") 
Default=OperationRegistry.RegRead("HKCR\") 
'
獲取一個空值 (null) 
  
OperationRegistry.RegWrite "HKCR\.xxf\",Default 
'
在根鍵HKEY_CLASSES_ROOT之下新建主鍵.xxf,並置其默認值爲空 
  
OperationRegistry.RegWrite "HKCR\.xxf\","xxffile" 
'
在根鍵HKEY_CLASSES_ROOT之下新建主鍵.xxf,並置其默認值?quot;xxffile" 
  
OperationRegistry.RegWrite "HKCR\.xxf\value1","string" 
'
在主鍵.xxf之下新建一個字符串型鍵值value1,並置其初始值爲"string" 
  
OperationRegistry.RegWrite "HKCR\.xxf\value2",1,"REG_DWORD" 
'
在主鍵.xxf之下新建一個REG_DWORD型鍵值value2,並置其初始值爲
  
OperationRegistry.RegWrite "HKCR\.xxf\value3",0Xff,"REG_BINARY" 
'
在主鍵.xxf之下新建一個二進制型鍵值value3,並置其初始值爲十六進制的ff 




  3RegDelete操做詳解 

  刪除操做RegDelete主要是用來刪除註冊表中已存在的主鍵或鍵值,該操做是一種極其危險的操做,它能將主鍵或鍵值絕不留情的在註冊表中"砍掉",不管該鍵值下面有多重要的數據,它都能暢行無阻,所以在使用該操做時務必當心。 

  刪除操做的參數形式與讀操做的參數形式幾乎徹底相同,只是有一點小小的區別,那就是刪除操做不須要將操做的返回值送給某一變量,例如: 

複製代碼代碼以下:


'delete.vbs 
Dim OperationRegistry 
Set OperationRegistry=WScript.CreateObject("WScript.Shell") 
OperationRegistry.RegRead("HKCR\.xxf\value") 
'
刪除.xxf主鍵之下的value鍵值 
OperationRegistry.RegRead("HKCR\.xxf\") 
'
刪除根鍵HKEY_CLASSES_ROOT之下的.xxf主鍵 



  強調一點,不要更改註冊表中已存在的主鍵或鍵值,更不要將它們刪除,由於對註冊表進行了不當的寫操做或刪操做,狀況嚴重的會致使系統崩潰!若是你真想這麼作,那就請你做好註冊表的備份。 
  
應用實例 

  1、讀本機"計算機名

複製代碼代碼以下:


'ReadComputerName.vbs 
Dim ReadComputerName 
Set ReadComputerName=WScript.CreateObject("WScript.Shell") 
Dim ComputerName,RegPath 
RegPath="HKLM\System\CurrentControlSet\Control\ 
ComputerName\ComputerName\ComputerName" 
ComputerName=ReadComputerName.RegRead(RegPath) 
MsgBox("
計算機名爲"&ComputerName) 




  2、隱藏快捷方式圖標上的小箭頭 

複製代碼代碼以下:


'Hidden.vbs 
Dim HiddenArrowIcon 
Set HiddenArrowIcon=WScript.CreateObject("WScript.Shell") 
Dim RegPath1,RegPath2 
RegPath1="HKCR\lnkfile\IsShortCut" 
RegPath2="HKCR\piffile\IsShortCut" 
HiddenArrowIcon.RegDelete(RegPath1) 
HiddenArrowIcon.RegDelete(RegPath2) 




  3、改造"開始"菜單 

複製代碼代碼以下:


'ChangeStartMenu.vbs 
Dim ChangeStartMenu 
Set ChangeStartMenu=WScript.CreateObject("WScript.Shell") 
RegPath="HKCR\Software\Microsoft\Windows\CurrentVersion\Policies\" 
Type_Name="REG_DWORD" 
Key_Data=1 
  
StartMenu_Run="NoRun" 
StartMenu_Find="NoFind" 
StartMenu_Close="NoClose" 
  
Sub Change(Argument) 
ChangeStartMenu.RegWrite RegPath&Argument,Key_Data,Type_Name 
MsgBox("Success!") 
End Sub 
  
Call Change(StartMenu_Run) '
禁用"開始"菜單中的"運行"功能 
Call Change(StartMenu_Find) '
禁用"開始"菜單中的"查找"功能 
Call Change(StartMenu_Close) '
禁用"開始"菜單中的"關閉系統"功能 




  4、向Windows中添加自啓動程序 
  該程序能在開機時自動運行。 

複製代碼代碼以下:


'AddAutoRunProgram.vbs 
'
假設該程序在c:\myfile文件夾中,文件名爲autorun.exe 
Dim AutoRunProgram 
Set AutoRunProgram=WScript.CreateObject("WScript.Shell") 
RegPath="HKLM\Software\Microsoft\Windows\CurrentVersion\Run\" 
Type_Name="REG_SZ" 
Key_Name="AutoRun" 
Key_Data="C:\Myfile\autorun.exe" 
'
該自啓動程序的全路徑文件名 
AutoRunProgram.Write RegPath&Key_Name,Key_Data,Type_Name 
'
在啓動組中添加自啓動程序autorun.exe 
MsgBox("Success!") 

 

CHR()函數

chr(9) tab空格 chr(10) 換行 chr(13) 回車 Chr(13)&chr(10) 回車換行 chr(32) 空格符 chr(34) 雙引號 chr(39) 單引號

 

chr(33) ! chr(34) " chr(35) # chr(36) $ chr(37) % chr(38) & chr(39) ' chr(40) ( chr(41) ) chr(42) *

chr(43) + chr(44) , chr(45) - chr(46) . chr(47) /

 

Chr(48) 0 Chr(49) 1 Chr(50) 2 Chr(51) 3 Chr(52) 4 Chr(53) 5 Chr(54) 6 Chr(55) 7 Chr(56) 8 Chr(57) 9

 

chr(58) chr(59) ; chr(60) < chr(61) = chr(62) > chr(63) ? chr(64) @

 

chr(65) A chr(66) B chr(67) C chr(68) D chr(69) E chr(70) F chr(71) G chr(72) H chr(73) I chr(74) J

chr(75) K chr(76) L chr(77) M chr(78) N chr(79) O chr(80) P chr(81) Q chr(82) R chr(83) S chr(84) T

chr(85) U chr(86) V chr(87) W chr(88) X chr(89) Y chr(90) Z

 

chr(91) [ chr(92) \ chr(93) ] chr(94) ^ chr(95) _ chr(96) `

 

chr(97) a chr(98) b chr(99) c chr(100) d chr(101) e chr(102) f chr(103) g chr(104) h chr(105) i

chr(106) j chr(107) k chr(108) l chr(109) m chr(110) n chr(111) o chr(112) p chr(113) q chr(114) r

chr(115) s chr(116) t chr(117) u chr(118) v chr(119) w chr(120) x chr(121) y chr(122) z

 

chr(123) { chr(124) | chr(125) } chr(126) ~ chr(127) chr(128) chr(153)™ chr(169) © chr(174) ®

 

 

reg文件

格式

1Windows 95/98/ME/NT 4.0第一行必須是"REGEDIT4"。而到了Windows 2000/XP/2003/Vistawindows操做系統則必需要是"Windows Registry Editor Version 5.00"

2:第一行後必須空一行。條與條之間最好也空一行。每行前不能留空格。

3:註冊表信息頭尾用"[""]"包起來;

4" "內就是字符串內容;"DWORD""0"就是用"dword:00000000"表示,反之是"1"則用dword:00000001來表示。

5:若是有兩個以上的註冊表信息,信息與信息之間就須要有空行隔開。

6:若是要刪除某個註冊表信息該怎麼辦?很簡單,在註冊表信息前面加上"-"(減)號

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

如何添加、 修改或刪除註冊表子項和值,經過使用.reg 文件

 

概要

重要:此部分、 方法或任務包含一些介紹如何修改註冊表的步驟。可是,若是不正確地修改了註冊表,可能會出現嚴重的問題。所以,請確保仔細按照下列步驟操做。爲增長保護,對其進行修改以前備份註冊表。而後,您能夠在出現問題時還原註冊表。有關如何備份和還原註冊表的詳細信息,請單擊下面的文章編號,以查看 Microsoft 知識庫中相應的文章:

本分步指南介紹如何添加、 修改或刪除註冊表子項和值,經過使用註冊項 (.reg) 文件。Regedit.exe 使用.reg 文件來導入和導出註冊表子項和值。這些.reg 文件可用於遠程分發到多臺基於 Windows 的計算機的註冊表更改。當您運行.reg 文件時,該文件的內容合併到本地註冊表中。所以,分發.reg 文件時必須謹慎。

語法。Reg 文件

.Reg 文件的語法以下

RegistryEditorVersion
空行
[RegistryPath1]

"DataItemName1"="DataType1:DataValue1"
DataItemName2"="DataType2:DataValue2"
空行
[RegistryPath2]

"DataItemName3"="DataType3:DataValue3"

其中:

RegistryEditorVersion
要麼是 Windows 2000 Windows XP Windows Server 2003 "Windows Registry Editor Version 5.00",要麼是 Windows 98 Windows NT 4.0 "REGEDIT4""REGEDIT4"頭還在基於 Windows 2000 的基於 Windows XP 的基於 Windows Server 2003 的計算機上工做。

空行是一個空行。這個標識新的註冊表路徑的開始。每一個項或子項是一個新的註冊表路徑。若是.reg 文件中有如下幾種按鍵,空白行能夠幫助您檢查並進行故障排除的內容。

RegistryPathx
是該子項包含您要導入的第一個值的路徑。將路徑括在方括號內,並由反斜槓分隔每一個層次結構級別。例如:

[HKEY_LOCAL_ MACHINE\SOFTWARE\Policies\Microsoft\Windows\System]

.Reg 文件能夠包含多個註冊表路徑。若是註冊表中不存在路徑語句中的層次結構的底部,將建立一個新子項。註冊表文件的內容發送到註冊表中輸入它們的順序。所以,若是您想要建立一個新子項與它下面的其餘子項,則必須按正確的順序輸入行。

DataItemNamex
是數據項的您想要導入的名稱。若是您文件中的數據項在註冊表中不存在,.reg 文件將添加該數據項的值)。若是數據項存在,.reg 文件中的值將覆蓋現有的值。數據項的名稱用引號引發來。緊跟在一個等號 = 後面的數據項的名稱。

DataTypex
是數據類型註冊表值,並緊隨等號。對於 REG_SZ (字符串值) 之外的全部數據類型,緊跟一個冒號數據類型。若是數據類型是 REG_SZ,則不包括數據類型值或冒號。在這種狀況下,Regedit.exe 假定 REG_SZ 爲數據類型。下表列出了典型的註冊表數據類型:

數據類型

在.reg 的數據類型

REG_BINARY

十六進制

REG_DWORD

Dword :

REG_EXPAND_SZ

hexadecimal(2)

REG_MULTI_SZ

hexadecimal(7)

有關注冊表數據類型的詳細信息,請單擊下面的文章編號,以查看 Microsoft 知識庫中相應的文章:
 

DataValuex當即跟隨冒號 (或等號後 REG_SZ),而且必須是以適當的格式 (例如,字符串或十六進制)。對二進制數據項使用十六進制格式。

注意:能夠輸入的同一註冊表路徑數據項目的若干行。

注意註冊表文件應包含在文件的底部的空行。

 

 

5,ThinAPP官方使用教程

http://pubs.vmware.com/thinapp4/help/wwhelp/wwhimpl/js/html/wwhelp.htm?href=setup_capture_install_app_postscan.html

 

Add a Value to the System Registry

 

Add a Value to the System Registry

This script procedure adds a value to the physical system registry.

Add a value to the system registry

1

Create a .reg file and run the regedit /s command as an external process that accesses the system registry instead of the virtual registry.

Function OnFirstParentStart

2

Create the .reg file in a location that has the IsolationMode parameter set to Merged so that the virtual environment can access it with this script and the physical environment can access it with the regedit /s command.

RegFileName = ExpandPath("%Personal%\thin.reg")

Set fso = CreateObject("Scripting.filesystemObject")

Set RegFile = fso.CreateTextFile(RegFileName, true)

The %Personal% directory is a directory that has Merged isolation mode by default.

3

Construct the .reg file.

RegFile.WriteLine("Windows Registry Editor Version 5.00")

RegFile.WriteBlankLines(1)

RegFile.WriteLine("[HKEY_CURRENT_USER\Software\Thinapp\demo]")

RegFile.WriteLine(chr(34) & "InventoryName" & chr(34) & "=" & chr(34) & GetBuildOption("InventoryName") & chr(34))

RegFile.Close

4

Add the information in the system registry.

RegEditPid = ExecuteExternalProcess("regedit /s " & chr(34) & RegFileName & chr(34))

WaitForProcess RegEditPid, 0

Wait until the process is complete.

5

Clean the environment.

fso.DeleteFile(RegFileName)

End Function

 

AddForcedVirtualLoadPath

AddForcedVirtualLoadPath

The AddForcedVirtualLoadPath(Path) function instructs ThinApp to load all DLLs from the specified path as virtual DLLs even if they are not located in the package.

Use this function if the application needs to load external DLLs that depend on DLLs located inside the package.

You can use the ForcedVirtualLoadPaths parameter in the Package.ini file to achieve the same result as this API function. For more information about "ForcedVirtualLoadPaths" see ThinApp Package.ini Parameters Reference Guide.

Parameters

Path

[in] The filename or path for DLLs to load as virtual.

Examples

You can load any DLL located in the same directory as the executable file as a virtual DLL.

Origin = GetEnvironmentVariable("TS_ORIGIN")

TS_ORIGIN is the path from which the executable file is running.

You can delete the filename from TS_ORIGIN by finding the last backslash and removing all of the characters that follow it.

LastSlash = InStrRev(Origin, "\")

SourcePath = Left(Origin, LastSlash)

You can instruct ThinApp to load all DLLs in the same or lower directory from where the source executable file resides.

AddForcedVirtualLoadPath(SourcePath)

This process enables you to drop additional files in the SourcePath tree and have them resolve import operations against virtual DLLs.

 

Checking ThinApp Installation Files

 

Checking ThinApp Installation Files

The ThinApp installation generates the VMware ThinApp directory in C:\Program Files\VMware. You might check the files in this directory to perform operations such as starting the Log Monitor utility to view recent activity.

The following key files in the VMware ThinApp directory affect ThinApp operations:

AppSync.exe – Keeps captured applications up to date with the latest available version.

logging.dll – Generates .trace files.

 

dll_dump.exe – Lists all captured applications that are currently running on a system.

log_monitor.exe – Displays the execution history and errors of an application.

 

relink.exe – Updates existing packages to the latest ThinApp version installed on the system.

sbmerge.exe – Merges runtime changes recorded in the application sandbox with the ThinApp project and updates the captured application.

 

Setup Capture.exe – Captures and configures applications through a wizard.

snapshot.exe – Compares the preinstallation environment and postinstallation environment during the application capture process.

ThinApp starts this utility during the setup capture process.

snapshot.ini – Stores entries for the virtual registry and virtual file system that ThinApp ignores during the process of capturing an application.

The snapshot.exe file references the snapshot.ini file. Advanced users might modify the snapshot.ini file to ensure that ThinApp does not capture certain entries when creating an application package.

template.msi – Builds the MSI files.

You can customize this template to ensure that the .msi files generated by ThinApp adhere to company deployment procedures and standards. For example, you can add registry settings that you want ThinApp to add to client computers as part of the installation.

thinreg.exe – Registers captured applications on a computer.

This registration includes setting up shortcuts and the Start menu and setting up file type associations that allow you to open applications.

tlink.exe – Links key modules during the build process of the captured application.

vftool.exe – Compiles the virtual file system during the build process of the captured application.

 

vregtool.exe – Compiles the virtual registry during the build process of the captured application.

 

Build Virtual Applications

Build Virtual Applications

You can adjust project files and build the application for deployment.

Build virtual applications in the Setup Capture wizard

1

(Optional) On the Ready to Build page, scan or change the project files.

   

Option

Description

Edit Package.ini

Modify application parameters for the entire package.

Open project folder

Browse ThinApp project files in Windows Explorer.

 

2

(Optional) To prevent a build from taking place, select the Skip the build process check box.

You can build the package at a later time with the build.bat file in the virtual application folder. For example, a Firefox 2.0.0.3 path to the build.bat file might be C:\Program Files\VMware\VMware ThinApp\Captures\Mozilla Firefox 2.0.0.3\build.bat.

3

Click Build to build an executable package or MSI package containing the files you installed during the capture process.

4

(Optional) Deselect the Open folder containing project executables after clicking Finish check box to view the executable files and MSI files at a later time.

 

5

Click Finish.

You can rebuild the package at any time after you click Finish to make changes.

 

Predefined Environment Variables

Predefined Environment Variables

The values for PackageIniOverrideFile (global and per application), ProjectPostProcessingCommand (global and per application), and InstallationCommand can contain environment variables. ThinApp Converter expands the value before using it.

ThinApp Converter adds these variables as predefined environment variables:

%AppInstallersRootDir% - The UNC path of the application installers that is specified in InputUncPath in the [Settings] section.

%AppInstallerDir% - The subdirectory under %AppInstallersRootDir% for the relevant application.

 

%ThinAppProjectsRootDir% - The UNC path for the generated ThinApp projects that is specified in OutputUncPath in the [Settings] section.

%ThinAppProjectDir% - The subdirectory under %ThinAppProjectsRootDir% for the relevant application.

Example

Following is an example of how predefined variables can be used in the PackageIniOverrideFileProjectPostProcessingCommand, and InstallationCommand parameters.

[Settings]

PackageIniOverrideFile=%AppInstallersRootDir%\AppSyncSettings.ini

;will resolve to \\AppInstallerServer\AppInstaller\AppSyncSettings.ini

[AppSettings:Adobe]

InstallationCommand=AdbeRdr920_en_US.exe /sAll

PackageIniOverrideFile=%AppInstallerDir%\override.ini

;will resolve to \\AppInstallerServer\AppInstaller\Adobe\AppSyncSettings.ini

 

Preparing the Configuration File for ThinApp Converter

Preparing the Configuration File for ThinApp Converter

A sample configuration file, ThinAppConverter.ini, is included in the ThinApp installation. The file is generally located in C:\Program Files\VMware\VMware ThinApp.

Modify or create a copy of this file to suit your requirements. Use UTF-8 encoding when you specify parameter values.

The ThinAppConverter.ini configuration file includes the following section headings:

[HostEnvironment] contains virtual machine hosting parameters.

[VirtualMachine N ] contains virtual machine-specific parameters.

 

[Settings] contains parameters that provide global control of the capture process.

[AppSettings: AppName ] contains optional application-specific parameters.

HostEnvironment

The HostEnvironment section of the configuration file contains the connection parameters for connecting to VMware ESX Server, VMware vCenter Server, or VMware Workstation on a local machine.

[HostEnvironment] parameters are mandatory.

You can only specify a single endpoint at a time in the configuration file. For example, if you plan to use a single VMware ESX Server, you can have ThinAppConverter.exe directly connect to that server.

You cannot specify more than one ESX server. To use more than one ESX server, configure ThinAppConverter.exe to connect to VMware vCenter Server, which manages multiple ESX servers.

 

You can use a locally installed VMware Workstation.

VirtualMachineHost

The name of the virtual machine to which ThinApp Converter is to connect.

To connect a single VMware ESX Server, use the IP address or host name of the ESX server.

To connect to VMware vCenter Server, use the IP address or HOST name of the vCenter server.

 

To connect to a local VMware Workstation instance, use localhost.

For VMware ESX Server or VMware vCenter Server, if you are not using standard HTTPS with port 443, you can specify the entire URL.

Examples

The following example shows a virtual machine specified by ESX server hostname.

[HostEnvironment]

VirtualMachineHost=MyEsx.vmware.com

The following example shows a virtual machine specified by IP address.

[HostEnvironment]

VirtualMachineHost=10.13.11.23

The following example shows a local machine specified as localhost.

[HostEnvironment]

VirtualMachineHost=localhost

HostLoginUserName

The login user name for the host machine.

Use the same login user name for connecting to the server as you use for logging in to the VMware vSphere Client. You must have sufficient privileges to turn on and off virtual machines, take virtual machine snapshots, and so on.

You can use UPN format when you specify a user name for vCenter. For example, user@domain.com.

HostLoginUserName is ignored when logging into VMware Workstation.

HostLoginPassword or HostLoginPasswordBase64

The login password for the host machine. You have the following options when you specify passwords:

You can enter clear text.

You can specify a base64 encoded password for the HostLoginPasswordBase64 parameter. Specifying an encoded password does not increase security. You need to protect the actual INI file.

All passwords are handled in the same way.

HostLoginPasswordPrompt

Specifies that the user be prompted to enter a password.

If you do not want to store the vSphere Server password in the configuration file, specify the value as true. When set to true, a prompt always appears, even if a HostLoginPassword is specified in the configuration file.

Example

The following example shows a typical host environment specification. The virtual machine name is specified as the ESX server hostname. A password has been specified, however the user will still be prompted to enter as password, as specified in HostLoginPasswordPrompt.

[HostEnvironment]

VirtualMachineHost=MyEsx.vmware.com

HostLoginUserName=root

HostLoginPassword=secret

HostLoginPasswordPrompt=true

VirtualMachineN

The VirtualMachineN section of the configuration file contains a list of the Windows-based virtual machines that will be utilized in the conversion process.

Create a VirtualMachineX section for each virtual machine that you want to include, and specify their parameters. X is 1, and subsequent virtual machine sections are numbered sequentially.

[VirtualMachine N ] parameters are mandatory.

VmxPath

Specify the configuration path of the virtual machine.

For ESX Server or vCenter Server, you can identify the virtual machine configuration file path using the vSphere Client.

Identify the virtual machine configuration path using the vSphere Client

1

Right-click the virtual machine and select Edit Settings.

2

Click the Options tab, and copy the string from the Virtual Machine Configuration File field.

 

3

Use this string as the virtual machine configuration file path.

For Workstation, specify the entire file path on the host on which the VMX configuration file resides. For example, C:\MyVMs\Windows XP\WindowsXP.vmx. Do not place the path in quotation marks, even if the path contains a space.

UserName

A valid user name for the virtual machine guest operating system. The user must have administrator privileges for the virtual machine guest operating system.

You can use UPN format when you specify a user name. For example, user@domain.com.

Password or PasswordBase64

A valid password for the virtual machine guest operating system. You have the following options when you specify passwords:

You can enter clear text.

You can specify a base64 encoded password for the PasswordBase64 parameter.

Specifying an encoded password does not increase security strength. You need to protect the actual INI file.

All passwords are handled in the same way.

If the Password setting is not used, the password for the guest is assumed to be blank. Most Windows virtual machines do not support automation with empty passwords, so you should specify a guest password.

PasswordPrompt

Specifies that the user be prompted to enter a password.

If you do not want to store the virtual machine password in the configuration file, specify the value as true. When set to true, a prompt always appears, even if a password is specified in the configuration file.

Examples

Following is an example for an ESX server-based environment. A password has been specified and, as PasswordPrompt is set to false, the user will not be prompted to enter a password.

[VirtualMachine1]

VmxPath=[Storage] WinXP_Converter/WinXP_Converter.vmx

UserName=administrator

Password=secret

PasswordPrompt=false

Following is an example for a VMware Workstation-based virtual machine. On virtual machine 1, PasswordPrompt has been set to true. The user will be prompted for a password even though a password has been specified in the configuration.

[VirtualMachine1]

VmxPath=C:\MyVMs\Windows XP\Windows XP.vmx

UserName=administrator

Password=secret

PasswordPrompt=true

[VirtualMachine2]

VmxPath=C:\MyVMs\Windows 7\Windows 7.vmx

UserName=adminuser@mydomain.com

Password=

PasswordPrompt=true

   

Note Do not place the path in quotation marks, even if the path contains a space.

Settings

The Settings section of the configuration file contains the parameters for the application installation directory and ThinApp project output directory, in the form of UNC. It also contains several parameters controlling the conversion process behavior.

ThinApp Converter only requires read-only permissions for the network share that contains the application installers. It requires read/write permissions for the network share that contains the ThinApp projects.

If input and output directories are on the same file server, you must use the same user account to connect them.

InputUncPath

Specify the network share UNC path for the application installers. For example: \\fileserver\sharename, or \\fileserver\sharename\dirname.

InputMountUserName

Specify the user name used for connecting to that network share. UPN format can be used when you specify a domain user, for example user@domain.com

InputMountPassword or InputMountPasswordBase64

Specify the password for connecting to the network share. You have the following options when you specify passwords:

You can enter clear text.

You can specify a base64 encoded password for the PasswordBase64 parameter.

InputMountPasswordPrompt

Specifies that the user be prompted to enter a password.

If you do not want to store the network share password in the configuration file, specify the value as true. When set to true, a prompt always appears, even if a password is specified in the configuration file.

OutputUncPath

Specify the network share UNC path to the location of the generated ThinApp projects.

For example: \\fileserver\sharename, or \\fileserver\sharename\dirname

OutputMountUserName

Specify the user name used for connecting to the OutputUncPath network share. UPN format can be used to specify a domain user, for example, user@domain.com.

OutputMountPassword or OutputMountPasswordBase64

Specify the password for connecting to the network share. You have the following options when you specify passwords:

You can enter clear text.

You can specify a base64 encoded password for the PasswordBase64 parameter.

OutputMountPasswordPrompt

Specifies that the user be prompted to enter a password.

If you do not want to store the network share password in the configuration file, specify the value as true. When set to true, a prompt always appears, even if a password is specified in the configuration file.

Example

Following is an example of network share specifications.The user for the application installation directory has only read permissions. For both the input and output network shares, a prompt will display, requiring a user to enter a password.

[Settings]

InputUncPath=\\AppInstallerServer\AppInstallers\ThinAppMigration

InputMountUserName=readonlyUser

InputMountPassword=secret

InputMountPasswordPrompt=true

OutputUncPath=\\DeploymentServer\ThinAppProj

OutputMountUserName=readwriteUser

OutputMountPassword=secret

OutputMountPasswordPrompt=true

ThinApp Converter Logic for Detecting the Application Installation Processes

For the application installer's network share, ThinApp Converter examines all subdirectories under the specified UNC path recursively, including their subdirectories. For each subdirectory, it determines which command to run for silent application installation using the following logic:

1

Attempts to find a value for InstallationCommand in the [AppSettings:AppName] section of the configuration file. If successful ThinApp Converter uses that value.

2

Attempts to find a file named install.cmd or install.bat. If successful, ThinApp Converter runs that file.

 

3

If ThinApp Converter finds a single .cmd or .bat file, it runs that file.

4

If ThinApp Converter finds a single .exe file, it runs that file.

 

5

If ThinApp Converter finds a single .mst file, it runs that file and adds the necessary silent installation switches.

6

If ThinApp Converter finds a single .msi file, it runs that file and adds the necessary silent installation switches.

If none of the steps enable ThinApp Converter to find a correct installation command, the subdirectory is skipped. A warning is logged in the log file.

You must remove all network connections to the file server referenced in the INI file from the host on which you run ThinApp Converter, to prevent conflict between user credentials.

PackageIniOverrideFile

Specify the file path to the global Package.ini override file.

This optional parameter enables you to specify a global override file for Package.ini that is generated for each ThinApp project. The values in the override file are merged into Package.ini in the ThinApp project that is generated for each application.

Global overrides are useful when you have a global policy setting, for example, PermittedGroup in Package.ini.

A Package.ini override file is formatted like a standard Windows INI file. You can add INI parameters and values that are relevant to the Package.ini file.

The path is relative to the application installer's network share. Using the example for specifying the network shares for the application installers and ThinApp projects, if you specify PackageIniOverrideFile=override.ini, ThinApp Converter will try to find the file under \\AppInstallerServer\AppInstaller. You can provide a more explicit value by using predefined variables. For more information, see Predefined Environment Variables.

You can specify a Package.ini file for each application. This process is described as part of the [AppSettings:AppName] section.

ExclusionList

Specify a comma- or semicolon-separated list of application directories that ThinApp will skip when searching for application installers.

The list is case insensitive.

You can specify wildcards for DOS-style file names. For example, Microsoft*. ? and * are supported.

Example

Following is an example of an exclusion specification using a wildcard.

[Settings]

ExclusionList=App?.old;FireFox1.0

ProjectPostProcessingCommand

Specify the file path to the project post processing command.

The file path is relative to the application installer's network share. Using the example for specifying the network shares for the application installers and ThinApp projects, if you specify ProjectPostProcessingCommand=addscript.bat, ThinApp Converter will try to find the file under \\AppInstallerServer\AppInstaller. You can provide a more explicit value by using predefined variables. For more information, see Predefined Environment Variables.

StopOnError

Specify whether ThinApp Converter should stop converting an application if it encounters an error, or continue with the other applications. The default value is false.

BuildAfterCapture

Specify whether the ThinApp Converter should build the ThinApp Projects into packages following capture.

The default value is true.

DetectIdle

Specify whether ThinApp Converter should try to detect if an application installer is stalled, for example when the application is waiting for user input on the guest virtual machine because incorrect silent installation switches were specified.

The default value is true. ThinApp Converter might not be able to detect all situations in which the installer is idle.

InstallerTimeout

Specify how long ThinApp Converter should wait for an application installer to finish before it quits.

By default, the value is 7200 seconds.

AppSettings:AppName

This optional section provides parameters that you can use to add settings that are specific to an application. AppName is the actual name of the subdirectory that contains the application installer. These parameters can be added to each AppSettings section. In most circumstances, you will not need to configure this section.

InstallationCommand

Specify how ThinApp Converter should start the application installer. If there is no value, ThinApp Converter attempts to select one installation command using the logic described in ThinApp Converter Logic for Detecting the Application Installation Processes.

PackageIniOverrideFile

The Package.ini override file that is applied to a single application installer. When this parameter has a value, the global override file is processed first, followed by this application-specific override file.

The file path is relative to the application installer subdirectory. Using the example at the bottom of this section, if you specify PackageIniOverrideFile=override.ini, ThinApp Converter will try to find the file under \\AppInstallerServer\AppInstaller\Adobe. You can provide a more explicit value by using predefined variables. For more information, see Predefined Environment Variables.

ProjectPostProcessingCommand

Specify the project post processing command for the specific application.

When this parameter has a value, the global override file is processed first, followed by this application-specific post processing command.

Example

Following is an example of how to apply an application-specific override during post processing.

[AppSettings:Adobe]

InstallationCommand=AdbeRdr920_en_US.exe /sAll

PackageIniOverrideFile=override.ini

[AppSettings:TextPad]

InstallationCommand=silent_install.bat

ProjectPostProcessingCommand=%AppInstallerDir%\addscript.bat

 

Customizing the snapshot.ini File

Customizing the snapshot.ini File

The snapshot.ini configuration file specifies what registry keys to exclude from a ThinApp project when you capture an application.

For example, if you use Internet Explorer 7, you might need ThinApp to capture the following registry keys:

HKEY_CURRENT_USER\Software\Microsoft\Internet   Explorer\Desktop\Components

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

 

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet  Settings\Connections

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\0001\Software\Microsoft\windows\CurrentVersion\Internet Settings

If the snapshot.ini file excludes the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections key by default, you can remove this key from the snapshot.ini file to ensure that ThinApp captures the key in the capture process.

If you do not customize the snapshot.ini file, the snapshot process loads the file from one of these locations:

Application Data\Thinapp\snapshot.ini

This location is the AppData directory of the user.

C:\Program Files\VMware\VMWare Thinapp\snapshot.ini

This is the location from which ThinApp runs the snapshot.exe utility.

 

Implement Scripts in a ThinApp Environment

Implement Scripts in a ThinApp Environment

Related topics

.bat Example

Timeout Example

Modify the Virtual Registry

.reg Example

Stopping a Service Example

Copying a File Example

Add a Value to the System Registry

You might implement a script in the following circumstances:

Timing out an application on a specific date.

Running a .bat file from a network share inside the virtual environment.

 

Modifying the virtual registry.

Importing the .reg file at runtime.

 

Stopping a virtual service when the main application quits.

Copying an external system configuration file into the virtual environment on startup.

Implement a script

1

Save the script contents in a plain text file with the .vbs extension in the same directory as your Package.ini file.

You can use any filename. ThinApp adds all .vbs files to the package at build time.

2

Rebuild the application.

 

Add a Value to the System Registry

Add a Value to the System Registry

This script procedure adds a value to the physical system registry.

Add a value to the system registry

1

Create a .reg file and run the regedit /s command as an external process that accesses the system registry instead of the virtual registry.

Function OnFirstParentStart

2

Create the .reg file in a location that has the IsolationMode parameter set to Merged so that the virtual environment can access it with this script and the physical environment can access it with the regedit /s command.

RegFileName = ExpandPath("%Personal%\thin.reg")

Set fso = CreateObject("Scripting.filesystemObject")

Set RegFile = fso.CreateTextFile(RegFileName, true)

The %Personal% directory is a directory that has Merged isolation mode by default.

3

Construct the .reg file.

RegFile.WriteLine("Windows Registry Editor Version 5.00")

RegFile.WriteBlankLines(1)

RegFile.WriteLine("[HKEY_CURRENT_USER\Software\Thinapp\demo]")

RegFile.WriteLine(chr(34) & "InventoryName" & chr(34) & "=" & chr(34) & GetBuildOption("InventoryName") & chr(34))

RegFile.Close

4

Add the information in the system registry.

RegEditPid = ExecuteExternalProcess("regedit /s " & chr(34) & RegFileName & chr(34))

WaitForProcess RegEditPid, 0

Wait until the process is complete.

5

Clean the environment.

fso.DeleteFile(RegFileName)

End Function

 

6,Cadence 15.2安裝問題記錄

Cadence 15.2運行錯誤,提示缺乏dll,但環境變量(HKEY_LOCAL_MACHINE.txt文件)裏是有路徑配置的:

 

 

附錄:

1@
通常在它以後緊跟一條命令或一條語句,則此命令或語句自己在執行的時候不會顯示在屏幕上。請把下面的代碼保存爲test.cmd文件,而後運行,比較一下兩條echo語句在屏幕上的輸出差別:
    echo a
    @pause
    @echo b
    @pause
執行結果以下:
        C:\Documents and Settings\JM\
桌面>echo a
        a
       
請按任意鍵繼續...

       
請按任意鍵繼續...

2%%%
百分號用在不一樣的場合,有不一樣的含義:
當百分號成對出現,而且其間包含非特殊字符時,通常作變量引用處理,好比:%var%%str%。把如下代碼保存爲批處理文件,運行後觀察屏幕顯示結果: 
    @echo off
    set str=abc
    echo
變量 str 的值是: %str%
    pause
在屏幕上將顯示這樣的結果:
       
變量 str 的值是: abc
       
按任意鍵繼續...
另外,百分號做爲變量引用還有一種特殊形式,那就是對形式參數的引用,此時,單個百分號後面緊跟0910個數字,如%0%1,其中,%0爲腳本自己的名稱,%1%9爲第二至九個參數...最多支持%0~%9,%10之後就是變量引用了,即%15爲%1的值接上5
請看演示代碼:
    @echo off
    if defined str goto next
    set str=
    set /p str=
請把文件拉到本窗口後回車:
    call "%~0" %str%
    pause
    exit
    :next
    cls
    echo
本批處理文件完整路徑爲:"%~0"
    echo
拖到本窗口的文件完整路徑爲:"%~1"
    goto :eof
出如今 set /a 語句中時,表示兩數相除取餘數,也就是所謂的模運算,它在命令行窗口和批處理文件中的寫法略有差別:在命令行窗口中,只須要單個的%,在批處理文件中,須要連續兩個百分號,寫成%%
例如:在命令行窗口中,運行 set /a num=4%2 ,則結果將顯示0,由於4除以2的餘數爲0;若是保存爲批處理文件,則此語句將略有改變:
    @echo off
    set /a num=4%%2
    echo 4
除以2的餘數爲 %num%
    pause
轉義符號:若是要顯示%自己時,須要在前面用%來轉義。例如:
    @echo off
    echo
一個百分號:%%
    echo
兩個百分號:%%%%
    echo
三個百分號:%%%%%%
    pause

3:::
:打頭的單個的:表示該行是一個標籤,它以後的內容是一個標籤段,如:test,則表示:test之下的內容是標籤段,而test是這個標籤段的名,能夠用 goto test goto :test 跳轉到該標籤段或用 call :test 調用該子過程;而連續兩個冒號打頭表示該行內容爲註釋內容,實際上,:: 是個無效的標籤名,:加上空格一樣能夠起到註釋的做用,此時,::的功能和註釋命令rem相同;可是,rem 註釋語句中的某些命令符號如重定向符號和管道符號仍是會執行,而若是用::來註釋的時候,與::同處一行的全部命令或符號直接被命令解釋器忽略掉,無形中提升了註釋的兼容性和整個程序的執行效率,而且在衆多的命令語句中更顯得醒目,因此,註釋語句推薦使用::的格式。
set 語句中:和~同時使用時,: 起到截取字符串的功能。假設 set str=abcde,那麼,set var=%str:~0,1% 表示截取字符串abcde的第一個字符;和=同時使用時,起到替換字符串的功能。假設:set str=abc:de,那麼,set var=%str:a=1% 則表示把字符串abc:de中的a替換爲1set var=%str::=2% 則表示把字符串abc:de中的:替換爲2

4~
用在 set 語句中,和:同時使用時,起到截取字符串的功能,請參考上一條的解釋;
用在 set /a 語句中時,它是一元運算符號,表示將操做數字按位取反,例如,set /a num=~1的執行結果是-2set /a num=~0的結果是-1
用在for語句中,表示加強for的功能,可以提取到更多的信息。例如:在批處理文件的for語句中:%%~i表示去掉第一對外側引號,%%~zi表示獲取文件的大小(以字節爲單位)%%~ni表示獲取文件名,%%~xi表示獲取擴展名(帶點號)……它們能夠組合使用,如%%~nxi表示獲取文件名和後綴名。

5>>>
通常而言,>表示用新內容覆蓋原文件內容,>>表示向原文件追加內容,此時,它們以重定向符號的身份出現;若是用在 set /a 語句中,則>表示分組,>>表示邏輯移位;

6|
通常而言,它以管道符號的身份出現,表示把在它以前的命令或語句的執行結果做爲在它以後的命令或語句的處理對象,簡而言之,就是把它以前的輸出做爲它以後的輸入,例如:echo abcd|findstr "b",表示把echo abcd的執行結果,做爲findstr "b" 的執行對象,也就是在字符串abcd中查找b字符;若是test.txt中有abcd字符串,則該語句與 findstr "b" test.txt 具備一樣的效果;

7^
通常而言,^以轉義字符的身份出現。由於在 cmd環境中,有些字符具有特殊功能,如>>>表示重定向,|表示管道,&&&||表示語句鏈接……它們都有特定的功能,若是須要把它們做爲字符輸出的話,echo >echo | ……之類的寫法就會出錯——cmd解釋器會把它們做爲具備特殊功能的字符對待,而不會做爲普通字符處理,這個時候,就須要對這些特殊字符作轉義處理:在每一個特殊字符前加上轉義字符^,所以,要輸出這些特殊字符,就須要用 echo ^>echo ^|echo ^|^|echo ^^……之類的格式來處理;

8&
通常而言,&表示兩條命令或語句同時執行的意思。如 echo a&echo b,將在屏幕上同時顯示ab字符。當幾條語句含義近似或做用相同且沒有前後的順序之別時,啓用&符號鏈接這些語句將會增長程序的可讀性;

9&&||
這是一對含義截然相反的命令符,&&表示若是它以前的語句成功執行,將執行它以後的語句,而||則表示若是它以前的語句執行失敗,將執行它以後的語句;在某些場合,它們能替代 if……else…… 語句;例如:
    @echo off
    md test&&echo
成功建立文件夾test||echo 建立文件夾test失敗
    pause
效果等同於以下代碼:
    @echo off
    md test
    if "%errorlevel%"=="0" (echo
成功建立文件夾test) else echo 建立文件夾test失敗
    pause

10()
小括號對常常出如今for語句和if語句中,還有一些特定場合;在forif語句中屬於語句格式的要求,例如:
for %%i in (語句1) do (語句2):在這條語句中,語句1必須用括號對包圍,而語句2的括號對則可視狀況予以拋棄或保留:若是語句2是單條語句或用&& &||等鏈接符號鏈接的多條語句,括號對能夠拋棄,若是語句2是有邏輯前後關係的多條語句集合,則必須保留括號對,而且,多條語句必須斷行書寫;例如:
    @echo off
    for %%i in (a b c) do echo %%i&echo --------
    pause
也能夠改寫爲:
    @echo off
    for %%i in (a b c) do (
        echo %%i
        &echo --------
    )
    pause
if 條件 (語句1) else (語句2):若是沒有else部分,則語句1的括號對無關緊要;若是有else部分,則語句1中的括號對必須保留,此時,語句2中的括號對保留與否,和上一點相似。例如:
    @echo off
    if exist test.txt echo
當前目錄下有test.txt
    pause
    @echo off
    if exist test.txt (echo
當前目錄下有test.txt) else echo 當前目錄下沒有test.txt
    pause
    @echo off
    if exist test.txt (echo
當前目錄下有test.txt) else (
        echo
當前目錄下沒有test.txt
        pause
        cls
        echo
即將建立test.txt文件
        cd.>test.txt&&echo
成功建立test.txt
    )
    pause
特定場合下使用括號對,不但可使代碼邏輯清晰,加強可讀性,還可能會減小代碼量。好比用echo語句構造多行文本內容的時候:
    @echo off
    (
    echo
第一行
    echo
第二行
    echo
第三行
    )>test.txt
    start test.txt
若是不使用括號對的話,則須要使用以下代碼:
    @echo off
    echo
第一行>test.txt
    echo
第二行>>test.txt
    echo
第三行>>test.txt
    start test.txt

11+-*/
set /a 語句中,這些符號的含義分別爲:加、減、乘、除。例如:set /a num=1+2-3*4/5。須要注意的是,這些運算符號遵循數學運算中的優先級順序:先乘除後加減,有括號的先算括號,而且,直接忽略小數點,所以,剛纔那個算式的結果是1而不是00.6
另外,有可能會在代碼中看到這樣的寫法:set /a num+=1set /a num-=1set /a num*=1 set /a num/=1,這些表示累加、累減、累乘、累除,步長都是1,展開後的完整寫法爲:set /a num=num+1set /a num=num-1set /a num=num*1 set /a num=num/1(set /a 語句中,變量引用能夠忽略百分號對或感嘆號對,set /a num=%num%+1 set /a num=num+1 等同)

12equneqlssleqgtrgeq
這幾個命令符是if語句中經常使用到的數值比較符號,取自英文的關鍵字母,具體的含義爲:
       
命令符號        含義                英文解釋
        EQU               
等於                equal
        NEQ               
不等於                 not equal
        LSS               
少於                 less than
        LEQ               
少於或等於         less than or equal
        GTR               
大於                 greater than
        GEQ               
大於或等於         greater than or equal

相關文章
相關標籤/搜索