无法从Windows注册表运行VBS文件 [英] Unable to run vbs file from windows registry

查看:518
本文介绍了无法从Windows注册表运行VBS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个调用一个VBScript文件below.It将选择更改光标选项来触发从右键点击.cur文件注册表项

I have a registry key that calls a vbscript file as below.It will be triggered on selecting a Change Cursor option from right click on .cur file

"C:\Program Files\Cursor Manager\CustomCursor.vbs" "%1" 2

下面是VBS文件(CustomCursor.vbs)

Below is the vbs file(CustomCursor.vbs)

Set objArgs = WScript.Arguments ' Create object.
CusorValue=objArgs(1)
Path=objArgs(0)
MsgBox CusorValue
MsgBox Path

但它不是working.Its没有显示任何信息

But its not working.Its not showing any message

它的工作当我打电话从命令提示符脚本像下面。

Its working when i am calling the script from command prompt like below.

"C:\Program Files\Cursor Manager\CustomCursor.vbs" "E:\new\CM v5\cursors new\more\Arrow.cur" 2

如果注册表值是批处理文件,它的工作

If the registry value is batch file its working

"C:\Program Files\Cursor Manager\CustomCursor.cmd" "%1" 2

下面是一个批处理文件(CustomCursor.cmd)

Below is batch file(CustomCursor.cmd)

echo %1
echo %2
pause

但我可以使用批处理文件,它会显示一个命令行窗口,因为它会显示命令窗口中执行脚本。

But i can use batch file as it will show a command window,as it will show command window while executing script.

请告诉我一个方法来执行从注册表VBS文件或至少运行在后台批处理文件的方式。

Please tell me a way to execute the vbs file from registry or atleast a way to run batch file in background.

感谢您

推荐答案

更改注册表

"%windir%\system32\wscript.exe" "C:\Program Files\Cursor Manager\CustomCursor.vbs" "%1" 2

问题是,直接调用脚本文件使Windows搜索程序来执行它并调用的脚本作为参数asociated可执行文件,但在这个过程中的论点,其余将被丢弃。称自己的脚本宿主与所有需要的参数。

The problem is that invoking directly the script file makes windows search for the program to execute it and call the asociated executable with the script as argument, but in this process the rest of the arguments are discarded. Call yourself the script host with all the needed arguments.

这篇关于无法从Windows注册表运行VBS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆