Colls,我写了一个脚本,它应该:
将文件从 C:\PR\DataFiles\Input\CL_CH5\"+k+"\ext_028042012.dat 复制到 C:\PR\DataFiles\Input\ext_028042012.dat - 工作正常
使用指定的命令行运行 cmd.exe (p.3)
运行 cmd.exe 后,脚本应该转到 c: 磁盘,然后将目录更改为 c:/pr,然后在 cmd 行中写入 «process.bat c:\pr ext_028042012.dat auto» 并按 Enter。
代码是:
var fso = new ActiveXObject("Scripting.FileSystemObject");
for (var k = -2; k <= 0; k++)
{
var out_dir = "C:\\PROBE\\DataFiles\\Input\\CL_CH5";
// now i am copying a ext_028042012 to destination folder
fso.CopyFile("C:\\PR\\DataFiles\\Input\\CL_CH5\\"+k+"\\ext_028042012.dat",
"C:\\PR\\DataFiles\\Input\\ext_028042012.dat", 1);
WScript.Echo(k+"file copied.");
/*Block which run cmd window*/
//The following code should open a command window, changes to the path to C:\ , and executes the DIR command.
var oShell = WScript.CreateObject ("WScript.Shell");
**oShell.run ("cmd /K cd c:\pr /K process.bat c:\ext_028042012.dat auto");**
WScript.Echo(k+ "file proceed!!!");
- 不幸的是,它不起作用。脚本不会将 p.3 中的命令行放到打开的 cmd.exe 窗口中。请告诉我我的错误在哪里。十分感谢。