Colls, I wrote a script which should:
-
copy a file from C:\PR\DataFiles\Input\CL_CH5\”+k+”\ext_028042012.dat to C:\PR\DataFiles\Input\ext_028042012.dat – works fine
-
run cmd.exe with specified command line (p.3)
-
after runing cmd.exe, script should go to c: disk, than change directory to c:/pr, then write in cmd line «process.bat c:\pr ext_028042012.dat auto» and press Enter.
Code is:
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!!!");
- Unfortunatly, it doesn’t work. Script doesn’t put command line from p.3 to opened cmd.exe window.
Please, tell me where is my mistake. Thank you a lot.
Your command string,
looks erroneous. I don’t believe you can specify several
/Kcommands like that – and since the meaning of/Kis “Carry out the command and continue” never ending the first shell you launch.Have you tried: