|
peterdocter
中级用户
  
积分 379
发帖 95
注册 2003-7-17
状态 离线
|
『楼 主』:
WshShell.Run 路径问题?
使用 LLM 解释/回答一下
set WshShell=Wscript.CreateObject("Wscript.Shell")
WshShell.Run("C:\Program Files\WinRAR\WinRAR.exe")
说不到指定的文件???
此文件存在的!
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\notepad "
在系统目录中调用程序程序就没有错误提示!!!
set WshShell=Wscript.CreateObject("Wscript.Shell")
WshShell.Run("C:\Program Files\WinRAR\WinRAR.exe")
Says the specified file cannot be found???
This file exists!
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\notepad "
Calling the program in the system directory has no error prompt!!!
|
|
2007-4-1 14:40 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
1、不要括号
2、VBS不使用%windir%此类变量(除非在批处理生成VBS),只要是存放在系统默认变量目录(CMD下set查看)的文件,直接写文件名就OK
1. Do not use parentheses
2. VBS does not use variables like %windir% (unless generating VBS in batch processing). As long as it is a file stored in the system default variable directory (viewed with set in CMD), just write the file name directly.
|
|
2007-4-1 14:57 |
|
|
peterdocter
中级用户
  
积分 379
发帖 95
注册 2003-7-17
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
WshShell.Run("C:\Program Files\WinRAR\WinRAR.exe")
vbs:对于函数调用有没有括号都可以,不要为了标准还是用括号。方便有时变成Js。这两们windos脚本语言几本差不多。不过要养成好的书写风格,还是建议函数调用加上括号。这也是Java以众多语言标准要求。
还有这个问题我已经解决了,主要是路径存在空格而产生间题。可用WshShell.Exec不过这个函数只要用于32程序。当然也要以这样解决WshShell.Run("C:\Progra~1\WinRAR\WinRAR.exe"),这个函数很怪好像回到dos状态有空格问题。vbs也是昨天才研究一下,如果有错请大家指正。其实JS与vbs基本一样,都可以实现相同的功能,不过由于JS存在本地权限调用问题,一样要扩展为*.hta这样就行了!一早忘记它的解译器名:)不过很多杀毒工具都很容易误杀此类文件:( 注意这样的JS是JScript是微软系统专用的就像VBscript一样不是JavaScript
WshShell.Run("C:\Program Files\WinRAR\WinRAR.exe")
VBS: For function calls, it doesn't matter whether there are parentheses or not. Don't use parentheses for the sake of being standard. It's convenient to sometimes turn into JS. These two Windows scripting languages are basically similar. However, to develop a good writing style, it is still recommended to add parentheses when calling functions. This is also required by the standards of many languages like Java.
Also, this problem has been solved. The main reason is that the path has spaces and causes problems. You can use WshShell.Exec, but this function is mainly for 32-bit programs. Of course, it can also be solved like this: WshShell.Run("C:\Progra~1\WinRAR\WinRAR.exe"). This function is very strange, it seems to return to the DOS state and has space problems. VBS was also studied yesterday. If there are any mistakes, please correct them by everyone. In fact, JS and VBS are basically the same, and they can both achieve the same functions. However, since JS has problems with local permission calls, it is the same to expand it to *.hta! I forgot its interpreter name early in the morning :) But many antivirus tools are very easy to misdetect such files :( Note that such JS is JScript, which is exclusive to the Microsoft system, just like VBscript, not JavaScript
|
|
2007-4-1 22:36 |
|
|
jmz573515
银牌会员
    
积分 1212
发帖 464
注册 2006-12-13
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
set WshShell=Wscript.CreateObject("Wscript.Shell")
WshShell.Run createobject("scripting.filesystemobject").getfile("C:\Program Files\WinRAR\WinRAR.exe").ShortName
set WshShell=Wscript.CreateObject("Wscript.Shell")
WshShell.Run createobject("scripting.filesystemobject").getfile("C:\Program Files\WinRAR\WinRAR.exe").ShortName
|
|
2007-4-1 22:43 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
 『第 5 楼』:
使用 LLM 解释/回答一下
给他加上引号不就完了,不用非要用短文件名
set WshShell=Wscript.CreateObject("Wscript.Shell")
WshShell.Run("""C:\Program Files\WinRAR\WinRAR.exe""")
Just add quotes to him, no need to use short filenames.
set WshShell=Wscript.CreateObject("Wscript.Shell")
WshShell.Run("""C:\Program Files\WinRAR\WinRAR.exe""")
|
|
2007-4-2 00:59 |
|
|
jmz573515
银牌会员
    
积分 1212
发帖 464
注册 2006-12-13
状态 离线
|
|
2007-4-2 01:11 |
|
|
wydos
中级用户
  
积分 304
发帖 117
注册 2006-4-4
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
5 楼的方法确实妙!!
The method on floor 5 is really wonderful!!
|
|
2007-4-2 02:02 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
WshShell.Run相当于你把后面的字符串贴到windows的开始菜单里的运行对话框
所以可以支持%windir%之类的变量。
所以路径含空格的问题就存在了。所以给你的调用的字符串加上引号就可以解决。
WshShell.Run is equivalent to you pasting the following string into the Run dialog box in the Windows Start menu.
So variables like %windir% can be supported.
Therefore, the problem of paths with spaces exists. So adding quotes to the called string can solve it.
|
|
2007-4-2 02:27 |
|
|
peterdocter
中级用户
  
积分 379
发帖 95
注册 2003-7-17
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
C:\Program Files\UltraISO\UltraISO.exe G:\viursINx\ISO\3SwordPE.iso
这样问题如何决定了?
C:\Program Files\UltraISO\UltraISO.exe G:\viursINx\ISO\3SwordPE.iso
How is such a problem determined?
|
|
2007-4-9 09:17 |
|
|
ywjco
初级用户
 
积分 31
发帖 17
注册 2007-10-31
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
N年前的问题,现在续:
——————————————
给出两个例子:
"D:\Program Files\Mozilla Firefox\firefox.exe" -safe-mode
"D:\Program Files\360\360safe\SoftMgr\SoftManager.exe" /page=3 /start=menuunist
空格分隔后,程序参数照样使用。
***************************所以,应该是:
set WshShell=Wscript.CreateObject("Wscript.Shell")
WshShell.Run("""C:\Program Files\UltraISO\UltraISO.exe"""G:\viursINx\ISO\3SwordPE.iso)
Proceeding with the previous problem, here's the continuation:
——————————————
Two examples are given:
"D:\Program Files\Mozilla Firefox\firefox.exe" -safe-mode
"D:\Program Files\360\360safe\SoftMgr\SoftManager.exe" /page=3 /start=menuunist
After splitting by spaces, the program parameters are still used as they are.
***************************So, it should be:
set WshShell=Wscript.CreateObject("Wscript.Shell")
WshShell.Run("""C:\Program Files\UltraISO\UltraISO.exe""" G:\viursINx\ISO\3SwordPE.iso)
|
|
2010-5-16 21:54 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 11 楼』:
挖坟?
使用 LLM 解释/回答一下
Originally posted by ywjco at 2010-5-16 21:54:
N年前的问题,现在续:
——————————————
给出两个例子:
"D:\Program Files\Mozilla Firefox\firefox.exe" -safe-mode
"D:\Program Files\360\3 ...
你这样错误吧。
Originally posted by ywjco at 2010-5-16 21:54:
An old question, continued now:
——————————————
Give two examples:
"D:\Program Files\Mozilla Firefox\firefox.exe" -safe-mode
"D:\Program Files\360\3 ...
You are wrong like this.
|

S smile 微笑,L love 爱,O optimism 乐观,R relax 放松,E enthusiasm 热情...Slore |
|
2010-5-16 22:06 |
|