1

这是我想改进的 VBScript。我想要四件事:

1) 添加一行,将扩展名 cleanup.dll 重命名为 cleanup.exe,以便它可以被 WshShell.run 调用并执行(隐藏)。

2) 就在下面写的方式,脚本打开两个屏幕:cleanup.exe 的屏幕和一个空白屏幕,应该为用户隐藏,这不是正在发生的事情!如何隐藏第二个屏幕?我想以不可见的方式运行它(用户无法关闭或操作第二个屏幕。它将通过 cleanup.exe 中的代码关闭)。**注意:下面的代码在 Windows XP 中完美运行,但在 Windows 7 上却不行.如何让它在所有Windows平台上工作?

VBSCRIPT "第二个.vbs"

Set WshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject") 
objFSO.MoveFile "cleanup.dll" , "cleanup.exe" 
WshShell.Run "c:\cleanup.exe", 0, TRUE
Set WshShell = Nothing

批处理“大师.bat”

@echo off
wscript Second.vbs
exit /b

3) 有没有好的可靠的软件可以从 VBS 转换为 EXE ?

4)我遇到的另一个问题是下面的命令行没有产生结果。我必须使用下面代码的第二部分吗?为什么 ??

假设我的批处理文件位于驱动器 f:\

如果我双击它,我的屏幕应该会填充从 TXT 文件中提取的信息,该文件实际上位于驱动器 c:\

@echo off
set DRV=C:\August\MyProgram
cd\
cd %DRV%
type test.txt & pause>nul


@echo off
set DRV=C:\August\MyProgram
cd\

c:

cd %DRV%
type test.txt & pause>nul

提前感谢您的解释和解决方案

4

1 回答 1

1

为什么使用批处理运行,vbscript 更强大,提供更多控制。

关于可见的控制台窗口 WshShell.Run "c:\cleanup.exe", 0, TRUE应该在运行时隐藏控制台并在继续之前等待确保使用 wscript.exe 而不是 cscript.exe 启动脚本并且不要使用任何 wscript.echo

重命名文件

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile "cleanup.dll" , "cleanup.exe"

关于批处理 cd,在控制台窗口中练习 cd 永远不会更改为驱动器,只会更改为另一个映射,驱动器:更改活动驱动器

d: => d:\>
c: => c:\> (so now if you are on c:\)
cd d:\test =>c:\ (changes your active map on d: to d:\test but since your c: drive is still the active drive you see nothing happening)
d: => d:\test (change drive to d:, you do see that the active map on drive d: is d:\test (at least with the default prompt)
于 2012-08-22T18:53:43.613 回答