我有一个VBS脚本生成一个URL来从我的网络上的服务器下载文件.我现在需要将文件下载到"C:\ rWallpaper\wallpaper.png",URL存储在变量"url"中
我喜欢它在linux上像wget一样工作,只需下载并将文件保存到指定位置即可.
我看到有人有一个文件(我猜一个批处理文件).在单击批处理文件时,他能够登录到多个站点.(也许它是用VB完成的.)
我在Google上找了这样一个脚本,但没有找到任何有用的东西.
我知道一些C++和UNIX(也有一些HTML和JavaScript).我不知道是否可以在使用这些语言的Windows机器上完成,但即使可以完成,我认为与VB或C##或其他一些高级语言相比也很困难.
我学会了如何使用批处理文件中包含的基本Windows批处理命令打开多个站点,如:
start http://www.gmail.com
start http://stackoverflow.com
Run Code Online (Sandbox Code Playgroud)
但我仍然无法弄清楚实际点击批处理文件如何帮助我登录到网站,甚至没有输入用户名和密码.
我是否需要开始学习Visual Basic,.NET或Windows批处理编程才能执行此操作?
还有一件事:我还可以用它来登录远程桌面吗?
有没有办法在VBS中列出已创建对象的可用方法?
例如:
Set IE = CreateObject("InternetExplorer.Application")
Run Code Online (Sandbox Code Playgroud)
我想列出此对象的可用属性,如下所示:
IE.AddressBar
IE.Application
IE.Busy
...
Run Code Online (Sandbox Code Playgroud)
或方法:
IE.ClientToWindow
IE.ExecWB
IE.GetProperty
...
Run Code Online (Sandbox Code Playgroud)
如何在VBS中发现任意有效对象的可用属性?
是否有一种从VBS脚本中访问网络共享的好方法,使用备用凭据(而不是运行VBS脚本的凭据)?
目的是执行两项任务:
据我所知,FSO(Scripting.FileSystemObject)不在图片中,因为它始终使用应用程序的凭据运行 - 这将是本地计算机用户.(?)
我在google搜索准备批处理文件(或扩展调用"cmd.exe")时发现的唯一可行的方法,使用"net use"提供远程共享凭据,然后使用robocopy等复制文件,来自同一个命令shell"session".这样可以将文件从本地驱动器复制/部署到远程共享,但是以这种方式进行任何类型的文件系统浏览(就像使用FSO一样)都会非常复杂和脆弱.
我考虑过的另一种可能性涉及两个脚本会话 - 您调用脚本(在命令行中提供备用凭据)并运行cmd.exe会话,该会话首先执行"net use"以将远程共享映射到临时本地驱动器,然后以"实际做东西"模式运行并使用FSO,然后当它完成(返回cmd.exe shell)时,再次使用"net use"断开临时驱动器.这是笨重的(多个窗口,临时驱动...),我甚至不确定它会工作.
有人知道任何一种方式,或知道可行的替代方案吗?(坚持在Windows 2000机器上使用VBScript/WScript - 没有PowerShell!)
在VBScript中,我需要确保用户输入一个整数.
这就是我现在拥有的:
WScript.Echo "Enter an integer number : "
Number = WScript.StdIn.ReadLine
If IsNumeric(Number) Then
' Here, it still could be an integer or a floating point number
If CLng(Number) Then
WScript.Echo "Integer"
Else
WScript.Echo "Not an integer"
End If
End if
Run Code Online (Sandbox Code Playgroud)
问题是CLng()不测试我的数字是否为整数:无论如何转换数字.
有没有办法检查数字是否是整数?
编辑:
建议的答案对我来说不起作用.这是我的代码的新版本:
WScript.Echo "Enter an integer number : "
Number = WScript.StdIn.ReadLine
If IsNumeric(Number) Then
' Here, it still could be an integer or a floating point number
If Number = CLng(Number) Then
WScript.Echo "Integer"
Else …Run Code Online (Sandbox Code Playgroud) 我正在使用该Shell.Application对象,它允许我编写zip文件的脚本.
但为了使其工作,我需要完整的zip文件路径. File.zip不起作用.c:\the\full\path\file.zip即使脚本在找到文件的同一目录中运行,我也需要.
如何在VBScript中获取文件的完整路径?
类似于%~fIcmd.exe shell中的扩展.
很久以前,我正在维护一个由外部公司用VB Script编写的经典ASP应用程序.
我有一个图像文件路径数组,如下所示:
dim banners, arrKeys, i
set banners=CreateObject("Scripting.Dictionary")
banners.Add "banner1.jpg", "http://www.somelink.com"
banners.Add "banner2.jpg", "http://www.somelink.com"
banners.Add "banner3.jpg", "http://www.somelink.com"
Run Code Online (Sandbox Code Playgroud)
这仅存在于包含横幅广告的网页上.有一些标准代码在包含文件中遍历此列表(所有页面都是通用的).
If Not banners Is Nothing then
' then loop through the Dictionary and make a list of image links
End if
Run Code Online (Sandbox Code Playgroud)
问题是如果banners没有在页面上实例化(它不在所有页面上),我会收到Can't find object错误
检查VB脚本中是否存在对象的正确方法是什么?
什么是相当于<%-- --%>在ASP经典?
我必须修改一个遗留的ASP应用程序,我想要注释掉一块HTML:
<td>
some table cell I'd like to comment out, including
some <%= inlineServerSideVBScriptExpressions() %>
</td>
Run Code Online (Sandbox Code Playgroud)
<%-- ... --%>如我在ASP.NET中所做的那样包装所有内容都不起作用并导致编译错误"预期语句".HTML注释<!-- ... -->也不是一个选项,因为内联ASP表达式将被评估并失败.
我是编程的新手,并且遇到了Cint溢出错误的麻烦.每当值达到100,000+时,我都会收到Cint溢出错误.这是我编程课程的一个练习练习.据我所知,我在实践中完全按照它编写的方式对其进行了编码,但实践表明使用的值高达300,000.有人可能会解释我可能做错了什么吗?
<script language="VBscript">
Option Explicit
DIM numberofshifts, totalshift1, totalshift2, _
totalshift3, grandtotal, shiftaverage
numberofshifts=3
totalshift1 = Inputbox("How many widgets during the first shift")
totalshift2 = Inputbox("How many widgets during the second shift")
totalshift3 = Inputbox("How many widgets during the third shift")
grandtotal = cint(totalshift1) + totalshift2 + totalshift3
shiftaverage = grandtotal / numberofshifts
Document.write "The Total of the Three Shifts is " & grandtotal
Document.write "<br>The Average of the Three Shifts is " & shiftaverage
</script>
Run Code Online (Sandbox Code Playgroud) 我需要运行一个命令,通过命令提示符使用vbs文件将文件从一个位置复制到另一个位置.这就是我所拥有的,但它一直在向我抛出错误.
'Dim oShell
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.run "cmd.exe /C copy "S:Claims\Sound.wav" "C:\WINDOWS\Media\Sound.wav"
Set oShell = Nothing'
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
'Script: C:\******\command.vbs
Char: 30
Error: Expected end of statement
Code: 80040401
Run Code Online (Sandbox Code Playgroud)
来源:Microsoft VBScript编译错误'
请帮忙 :)
vbscript ×10
asp-classic ×2
autologin ×1
javascript ×1
object ×1
path ×1
reflection ×1
windows ×1