我有一个应用程序,我试图在Windows 7和Windows XP瘦客户端上升高,但我似乎无法让runas.exe cmd行正确.我知道我需要反斜杠转义字符,因此runas正确解释了空格.这在运行runas时使用反斜杠转义的单个参数时有效.这个场景是我发现的所有解决方案,然而它起作用,我需要发送多个参数,这些参数都是用反斜杠转义的,因为文件路径等因为空格而存在争议.以下是一些例子:
这些工作和预期的将提示管理员密码:
runas.exe /user:Administrator "C:\update_andon.exe autosetup /kiosktype:\"Andon Kiosk"\
runas.exe /user:Administrator "C:\update_andon.exe autosetup /directory:\"C:\Program Files\CIMS_Andon\Kiosk"\
当我开始添加我需要的其余参数(如下面的行)时,我收到runas帮助文本,表明存在问题:
runas.exe /user:administrator "C:\update_andon.exe autosetup /kiosktype:\"Andon Kiosk"\ /exename:\"eAndonKiosk.exe"\ /directory:\"C:\Program Files\CIMS_Andon\Kiosk"\ /repository:\"\\domain\sat\shared\repository\andon kiosk"\"
一种解决方案是一个接一个地运行每个参数,但我不认为这是一个解决方案,因为它是一个解决方法.我是否错过了将反斜杠与各种参数混合在一起的方式?我在哪里错过了更多的报价?
谢谢
如果我正在做的事情完全错误或解决方案是显而易见的,请不要感到惊讶.
<script type="text/vbscript">
Function AddPrinter()
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection "\\a2031slhsfile1\2031CAT-T113-HP4014dn"
objNetwork.SetDefaultPrinter "\\a2031slhsfile1\2031CAT-T113-HP4014dn"
MsgBox "The printer was added and set as the default printer."
End Function
</script>
Run Code Online (Sandbox Code Playgroud)
我将上面的vbscript添加到head部分的HTML文档中,其中一个按钮具有以下属性:
onclick="AddPrinter()"
Run Code Online (Sandbox Code Playgroud)
在Google上搜索一小时后,我对此并没有太多了解.我发现的东西不起作用.它是如何知道你是从javascript还是vbscript调用函数还是其他什么?
我收到此错误:
SCRIPT429: ActiveX component can't create object: 'WScript.Network'
Run Code Online (Sandbox Code Playgroud) 亲爱的同事们!我需要你的帮助.
最重要的是,这不是广告.我尝试在铁路车票网站http://booking.uz.gov.ua/en/上发出POST请求,以了解当前日期是否有门票.但是......有问题.我正在使用VBScript发出请求.要知道在网站上发送的HTTP标头和POST请求,我使用的是Chrome内置开发工具.
这是我的脚本:
Dim URL
Dim URL2
Dim URL3
Dim sRequest
Dim sCookies
'This is web page where I need to enter information.
URL = "http://booking.uz.gov.ua/en/"
'This is path that Chrome shows to send POST request.
URL2 = "http://booking.uz.gov.ua/en/purchase/search/"
'Optional URL, Chrome shows this link near of URL2. I think this is .js that works on info I enter on web site (URL).
'URL3 = "http://booking.uz.gov.ua/i/js/common.138.js"
'POST request that Chrome shows to send.
sRequest ="station_id_from=2200001&station_id_till=2208001&station_from=Kyiv&station_till=Odesa&date_ dep=09.19.2013&time_dep=00%3A00&search="
'Here I'm …Run Code Online (Sandbox Code Playgroud) Using VBScript, I'm trying to run a subroutine that resides in one of the code modules. Now this particular sub calls several other subs/functions, including few that reside on the sheet modules. And on calling these subs residing in Sheet Modules, I get can error:
"Sub or Function undefined!"
Run Code Online (Sandbox Code Playgroud)
How can I get around this? There are a lot of such functions and I don't want to move all of them from Sheet modules to code modules. Is there a …
我正在尝试编写一个脚本,每个星期晚上复制一个文件夹。我希望它每晚在目标目录中创建一个文件夹。
因此,我试图制作一个将“ C:\ logs”复制到“ I:\ logs \ today's date”的脚本
因此目标文件夹应如下所示
“ I:\ logs \ Monday_1272014”,那么第二天晚上应该看起来像这样“ I:\ logs \ Tuesday_1282014”
等等,每个工作日。我不确定自己是否有道理,但会有所帮助。
到目前为止,我已经将其用于Robocopy脚本:robocopy“ E:\ Batch Files”“ I:\ Backups \ Monday” / MIR
但这只会创建一个名为Monday的文件夹。任何帮助将不胜感激。同样,它不必是robocopy。我只是用它,因为它是我所知道的唯一一个。我不介意学习如何将其作为批处理文件或VB脚本来进行。
谢谢!
我有一个输入文件名的vbscript
代码是
Dim tsout: Set tsout = gofs.CreateTextFile("C:\....csv")
Dim tsin: Set tsin = gofs.OpenTextFile("C:\.....csv")
Run Code Online (Sandbox Code Playgroud)
如何配置这个以便createTextFile(....)从配置文件中读取路径(.ini)
用于创建和写入输出的文件路径必须从ini文件中获取
这是我的ini文件
//我的ini文件
[Read_file]
tsout=E:.....tt.csv
tsin=E:\....gt.csv
[col]
Number1=4
Number2=5
Run Code Online (Sandbox Code Playgroud) 我的页面是带有VBScript的ASP.我有两个不同的记录集,每个记录集都有自己的数组(通过使用RS.GetRows()方法).基本上,我想将这两个数组合并为一个数组.请参阅下面的演示.
请帮忙,谢谢....
Dim array1
array1(0,0)="a"
array1(0,1)="b"
array1(1,0)="c"
array1(1,1)="d"
Dim array2
array2(0,0)="e"
array2(0,1)="f"
array2(1,0)="g"
array2(1,1)="h"
///// I want to combine into one array something like this. //////
Dim array1
array1(0,0)="a"
array1(0,1)="b"
array1(1,0)="c"
array1(1,1)="d"
array1(0,2)="e"
array1(0,3)="f"
array1(1,2)="g"
array1(1,3)="h"
///// Basically, same columm numbers, but adding more data/rows to the existing array.
OR if this is not doable, is there a way to combine these arrays into a brand new array?
///// I have this much so far, but couldn't get it to …Run Code Online (Sandbox Code Playgroud) 只是想知道我怎么能有一个MSgbox显示变量的值,因为它不断变化.基本上每次循环时都会添加一个数字.我想在一个不需要打开一百万个窗口的MSGbox中显示它
我注意到在使用它之后我可以Dim使用变量,或者(换句话说)在使用之前使用它,即使在使用时也是如此.试试这个:DimOption Explicit
Option Explicit
x = "before Dim"
WScript.Echo x
Dim x
x = "after Dim"
WScript.Echo x
Run Code Online (Sandbox Code Playgroud)
同样在a Sub或Function.
显然,不要紧上线的Dim是,只要是在同一范围内(电流Function/ Sub或全球).我想知道为什么会这样.微软的文档明确说明(强调我的):
脚本级变量的生命周期从声明的时间延长到脚本完成运行的时间.
我读的就像:先Dim使用.但是我错了...?为什么是这样?!
VB6也不会允许这样的:
---------------------------
Microsoft Visual Basic
---------------------------
Compile error:
Variable not defined
---------------------------
OK Help
---------------------------
Run Code Online (Sandbox Code Playgroud) 我想知道是否有一种方法可以在运行某个命令后最小化批处理窗口。我已经知道启动/ min和最小化启动窗口的技巧,但是在运行循环或超时时该怎么办?
比方说:
echo Hello!
timeout /t 100
:COMMAND TO MINIMIZE WINDOW WHILE TIMEOUT IS RUNNING
Run Code Online (Sandbox Code Playgroud)
现在,我在bat文件中调用一个autoit脚本,以在命令运行时隐藏窗口:
WinSetState($application_name, "", @SW_HIDE)
Run Code Online (Sandbox Code Playgroud)
但我正在寻找可以直接在.bat文件中编码的纯批处理/ powershell / vbs解决方案。
感谢您的时间!