& H& J8 L: U* y2 V( b % p6 ~' @) a3 ?. r/ h 你只需在记事本中依次输入以下每个实例中的代码,并保存为相应的“*.vbs”文件,双击这个文件,你就可以看到相应的效果了。 ) L" f0 R0 q R( F/ ]2 ?8 s# `: q" Y: w. x+ H- z. U
- e5 X/ p& d/ a" L/ }
9 S: g' w" o& ~
- T+ c' |1 I0 f, ~. J+ r! o
) h5 p- U$ h- t1 |( W/ C& t" q 4 S1 e: l& N- C0 Y' {4 t& j 8 M' f5 r( o1 O4 l" d# pQ: How do I open script files? Trying the above solution makes Windows XP throw an error? 6 m5 o; T! t6 S( q$ z ~+ N - N; O$ { u0 O8 w/ n" B1 gA:This is similar to the *.js association problem. Some machines seem to,for some reason, lose their *.vbs association. It's not that the filesopen with dreamweaver or whatever -- it's that the machine just doesn'tknow how to run them. If you have a scheduled task, "Could not run"will appear in the status column. e, a f3 U) c# d) w6 i1 U - F' B; z; R2 U, s* fSo, you're a smart person andread through the FAQ. You find the *.js extension problem, and you trythat fix: you run it as "wscript c:\path\to cript.vbs". But that, inturn, produces a pop-up error, this time a "Windows Scripting Host"error: "There is no script engine for file extension '.vbs'." So, forsome reason, wscript doesn't even know what to do with *.vbs files. 5 b; @9 ~0 X4 O) g, U$ A$ D5 w S- ?5 ^" M/ |8 ]- o
The solution to this problem is to run the script as:! f$ y+ i; |9 @# e% Q4 U0 }
+ L' o7 F, J jwscript //e:vbscript c:\path\to cript.vbs2 |; O. z A2 O* u+ p
+ ~7 ^% O% O+ p. s% F3 [9 Z3 yThe "//e:vbscript" tells wscript to use the vbscript engine to parse the script. It will then run correctly.; Q' M* d3 F/ [1 i/ @5 B
; ]1 k4 l' X- y* Q t3 KA few alternative solutions, perhaps easier are:8 v1 ^6 r/ `5 \
Renameit .vbe (VBScript Encoded Script File). Not sure if this is a bad idea,but it seemed to work for some scripts. Make a new association for VBS.Open up my computer, select Tools menu-> Folder Options, and go tothe File Types tab. There probably isn't a VBS association listed ifyou have this problem. Select New, type in VBS, and hitAdvanced>>. Then, from the pull-down menu, select "VBScriptScript File". Making this selection automatically takes care of theassociation, along with the //e:vbscript problem. This is probably the"correct" solution... 9 V$ `# E- O0 P$ A
This problems usually occurs only on WindowsXP machines, but the cause is not known. A Microsoft KB article on thisissue can be found here. Thanks goes to Bob_2k for writing this FAQentry.