带空格的文件夹名称 [英] Folder Names with Spaces
本文介绍了带空格的文件夹名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< html >
< head >
< title > Application Executer < / title >
< < span class =code-leadattribute> HTA:APPLICATION ID = oMyApp
APPLICATIONNAME = Application Executer
BORDER = no
CAPTION = no
SHOWINTASKBAR = 是
SINGLEINSTANCE = 是
SYSMENU = 是
SCROLL = no
WINDOWSTATE = 普通 >
< script type = text / javascript 语言 = javascript >
函数RunFile(){
WshShell = new ActiveXObject ( WScript.Shell);
WshShell.Run(c:/windows/system32/notepad.exe,1,false);
}
< / script >
< / head >
< body >
< 输入 类型 = 按钮 value = 运行记事本 onclick = RunFile(); / >
< / body >
< / html >
在我从你的网页上执行的上面代码中,如果wshshell.run中的文件名有空格怎么办:
示例:wshshell.Run(c:windows / user / public / public desktop / avg.exe
公共桌面有空间,无论我尝试什么文件都找不到。
已尝试xxxx在整个声明周围试过'xxxx'..
我无法重命名文件夹取出空间。
解决方案
在我的系统(Windows 7)上,公共桌面位于C:\ Users \Public \Desktop。
它们都不在Windows目录中,也没有错过在驱动器规范之后的分隔符,也不在公共桌面文件夹中。
您应该从资源管理器中检查您想要到达的路径;记得在地址栏中选择路径,因为它的呈现方式取决于它的选择与否。
我终于找到了解决方案:
我添加了''到路径
WshShell.Run('C:/ Program Files /Calibre2/Calibre.exe')
<html>
<head>
<title>Application Executer</title>
<HTA:APPLICATION ID="oMyApp"
APPLICATIONNAME="Application Executer"
BORDER="no"
CAPTION="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
SCROLL="no"
WINDOWSTATE="normal">
<script type="text/javascript" language="javascript">
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
}
</script>
</head>
<body>
<input type="button" value="Run Notepad" onclick="RunFile();"/>
</body>
</html>
IN the Above Code which I coped from your web page, What if the file names in the wshshell.run has spaces:
Example: wshshell.Run("c:windows/user/public/public desktop/avg.exe"
Public Desktop has a space and no matter what I try the file can not be found.
have tried "" xxxx "" around the whole statement have tried "' xxxx '" ..
I can't rename the folder an take out the space.
解决方案
On my system (Windows 7), the public desktop is located in C:\Users\Public\Desktop.
Neither is it in the Windows directory, nor has it a missing separator after the drive spec, nor is it in a "Public Desktop" folder.
You should check the path that you want to reach from the Explorer; remember to select the path in the address bar, because how it is presented depends on the fact it is selected or not.
I finally found a solution:
I added ' ' to the path
WshShell.Run ('"C:/Program Files/Calibre2/Calibre.exe"')
这篇关于带空格的文件夹名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文