function test()
{
var myshell = new ActiveXObject( "WScript.shell" );
//myshell.Run('d:');
myshell.Run('cd D: \\php_code\\abc\\');
delete myshell;
}myshell.Run('cd D: \\php_code\\abc\\');报错了 请问要怎么改?
{
var myshell = new ActiveXObject( "WScript.shell" );
//myshell.Run('d:');
myshell.Run('cd D: \\php_code\\abc\\');
delete myshell;
}myshell.Run('cd D: \\php_code\\abc\\');报错了 请问要怎么改?
cd D:\\php_code\\abc\\
这样呢
myshell.Run('cd D: \\php_code\\abc\\'); ==>
myshell.Run('cd D://php_code//abc//');
myshell.Run('cd D:\\\\php_code\\\\abc\\\\');
myshell.Run('cd D:\/\/php_code\/\/abc\/\/');
这是整个文件,可以试试
谢谢各位了<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function test()
{
var myshell = new ActiveXObject( "WScript.shell" );
//myshell.Run('d:');
myshell.Run('cd D:\\php_code\\abc\\');
delete myshell;
}
</script>
</head><body onload="test()">
</body>
</html>
但是var myshell = new ActiveXObject( "WScript.shell" );执行之后他指向的是另一个文件夹,如果我直接执行压缩命令的话,我把那个要压缩的文件的绝对路径传进去,这我可以做到,但是他压缩出来之后压缩文件里面的路径也是他的绝对路劲来的,这不是我想要的,所以只能进入到这个目录myshell.Run('cd D:\\php_code\\abc\\');中去对相对路劲的文件夹执行压缩命令,但是他老是报错。
myshell.Run('D:\\php_code\\abc\\');这句可以,直接打开了目录。
反正这个run的功能就是如此~