Perl
getScriptDirectory.pl
use strict;
use File::Spec::Functions qw(rel2abs);
use File::Basename;
print dirname(rel2abs($0)) . "\n";
use FindBin '$Bin';
print "$Bin\n";
my $line =~ tr/"//d;
==================================================
Inside of a batch file, %0 is the call of the batch file itself. It may look something like this...
Run from UNC Path:
%0 = "\\server\users\mystuff\Temp\My Test\My Batch File.cmd"
%~0 = \\server\users\mystuff\Temp\My Test\My Batch File.cmd
%~d0 = \\
%~p0 = server\users\mystuff\Temp\My Test\
%~dp0 = \\server\users\mystuff\Temp\My Test\
Run from Mapped Drive:
%0 = "H:\Temp\My Test\My Batch File.cmd"
%~0 = H:\Temp\My Test\My Batch File.cmd
%~d0 = H:
%~p0 = \Temp\My Test\
%~dp0 = H:\Temp\My Test\
ttp://www.myitforum.com/forums/m_178011/mpage_1/key_batch/tm.htm#178011
結論:
%~dp0 = 該BATCH FILE實在位置
%cd% = CALL 該 BATCH FILE的位置
BATCH FILE
SET VAR = 72
結果:
"VAR " = 72
"VAR" = NULL
這不是C,空格也是當變數名稱
==================================================
msi
package code --> msi 的身分證 (外在), 屬於 xxx.msi 這msi本身的ID
M$ Windows 會用這個 code 找 cache
product code --> 裏面的東東
upgrade code --> 同一血統證明?
參考:
ttp://www.acresso.com/webdocuments/PDF/0012_50ef.pdf
==================================================
C++和Java 有這種
char ch = str[2];
但天殺的VBS卻沒有這個...
近似替代品
Function at(str,index)
if (index <= 0) Then
at = ""
else
at = mid(str,index,1)
end if
End Function
''' Driver Program '''
MsgBox "Start the script"
Dim str
str = "abcdefg\n\tttt/.../3\"
Dim count
For count = 0 to len(str)
MsgBox at(str ,count)
Next
MsgBox "End of script"
VBS壞習慣 -- 習慣了C++,C#和Java 之類的,所以會不自覺地在每句加上;
結果Compilation Error \(^O^)/
在InstallShield內 Compilation Error時是什麼訊息也不會告訴你...
======================================
LPCWSTR UniString = L"Some Unicode String";
//LPCWSTR Str = "Some Unicode String"; // fail to compile
參考:
ttp://www.flipcode.com/archives/Advanced_String_Techniques_in_C-Part_I_Unicode.shtml
結論:
還是用Unicode
======================================
Link the Advapi32.lib and shell32.lib to call project
unresolved external symbol
string fullpath = directory.append("xxx.txt");
ofstream myfile;
//myfile.open (fullpath); // error
myfile.open (fullpath.c_str());
SHFileOperation Function with SHFILEOPSTRUCT, may use SetFileAttributes(Dir,FLAGS);
for some file operations