vbs

VBS脚本:计算还需要净胜多少局才能让自己的扫雷胜率增长1%

谁说胖子不能爱 提交于 2019-12-05 15:06:38
程序说明 作为一个扫雷爱好者,今天突然想做一个脚本,看看自己还剩下多少局才能让胜率增长1个百分点 脚本通过已玩游戏数和已胜游戏数,推算还需要连胜多少局游戏才能让自己的获胜率增长一个百分点 获胜率是已胜游戏除以已玩游戏的商精确到小数点后两位后乘以百分之百,小数点后两位以后的数字全部舍去 比如72/359=0.20055710306407,因此当前的获胜率是20% 赢一局,胜率为73/360 = 0.20277777777778→胜率20% 赢两局,胜率为74/361 = 0.20498614958449→胜率20% 赢三局,胜率为75/362 = 0.20718232044199→胜率20% 赢四局,胜率为76/363 = 0.20936639118457→胜率20% 赢五局,胜率为77/364 = 0.21153846153846→胜率21% 因此,以当前状态再连胜5局,就可以让胜率增长到21% 在两个InputBox中输入359和72后,脚本会提示这样一个MsgBox 需要注意的是 1)如果不是全胜,那么胜率是无法达到100%的,也就是如果有失败场次,99%就是最高胜率了 2)VBS脚本通过InputBox输入的数字,要先经过IsNumeric判断,再经过CInt转换为数字,才能放心使用 脚本代码 Option Explicit 'On Error Resume Next Dim

使用VBS脚本实现的Hosts文件一键配置

柔情痞子 提交于 2019-12-05 10:20:23
hosts文件存储了IP地址与域名的映射。因为有的时候需要经常性地配置hosts文件,因此这段时间我琢磨了一套傻瓜化的hosts文件配置方案,记录如下。 先说一下怎么样进入hosts文件,Windows环境(我用的是一个32位的Win7)下hosts文件在计算机中的位置,在目录%windir%\System32\drivers\etc\,文件名为hosts,没有扩展名。不过相比每次都要点很多目录才能找到hosts文件,我们可以通过执行下面这个bat脚本直接用记事本打开hosts文件: @echo off if "%1" == "h" goto begin mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit :begin notepad %SystemRoot%/System32/drivers/etc/hosts exit 将这个bat脚本取名为host.bat,放在C:\Windows\System32下,就可以实现在命令行里或是Win7的开始菜单中直接输入host命令打开hosts文件了。 言归正传,下面我来说下如何自动向hosts文件后面插入记录。 下面这个bat脚本,可以满足最简单的hosts配置,即在hosts文件的最后追加一条记录: @attrib -r "

Windows 10/Win10命令大全通用(Win8,Win7)

China☆狼群 提交于 2019-12-03 09:32:06
Windows 10/Win10命令大全通用(Win8,Win7) 1.calc:启动计算器   2 .appwiz.cpl:程序和功能   3.certmgr.msc:证书管理实用程序   4.charmap:启动字符映射表   5.chkdsk.exe:Chkdsk磁盘检查(管理员身份运行命令提示符)   6.cleanmgr: 打开磁盘清理工具   7.cliconfg:SQL SERVER 客户端网络实用工具   8.cmstp:连接管理器配置文件安装程序   9.cmd.exe:CMD命令提示符   10.自动关机命令   Shutdown -s -t 600:表示600秒后自动关机   shutdown -a :可取消定时关机   Shutdown -r -t 600:表示600秒后自动重启   rundll32 user32.dll,LockWorkStation:表示锁定计算机   11.colorcpl:颜色管理,配置显示器和打印机等中的色彩   12.CompMgmtLauncher:计算机管理   13.compmgmt.msc:计算机管理   14.credwiz:备份或还原储存的用户名和密码   15.comexp.msc:打开系统组件服务   16.control:控制面版   17.dcomcnfg:打开系统组件服务   18.Dccw:显示颜色校准

使用虚拟按键表和winhotkey设置音量控制等快捷键

倾然丶 夕夏残阳落幕 提交于 2019-12-03 06:54:27
首先我们需要有windows虚拟按键表: Virtual-Key Codes (Windows) 调节音量 以我们想要控制的音量为例: 可以发现调低音量对应的按键是0xAE, 调高音量是0xAF 但是上面的这个虚拟按键无法在cmd中使用,我们需要使用vbs(VB script脚本, windows脚本文件,VBS的全称是:Microsoft Visual Basic Script Edition)来完成操作 以下回答参考自知乎用户 雁南归 刚好遇到这个问题。普通键盘上没有音量键,只好用WinHotKey映射一个脚本。没找到cmd命令,最后用vbs解决了。 新建一个文本文件,后缀名为 vbs 填入代码 Set wshell = Wscript.CreateObject("Wscript.Shell") key = chr(&h88AF) wshell.Sendkeys key 其中key=chr(&h88AF)这句是把 window下虚拟按键转换为一个中文字符。AF是 Volume Up key 的16进制编码。 由于 Wscript.Shell.SendKeys 只接受一个中文字符,所以就在前面加上一个88把它转换为Unicode码。 这个是音量上调的,下调吧AF换成AE就可以了。 作者:雁南归 链接:https://www.zhihu.com/question/38692693

[非原创]Office 2019 增强版 批处理激活 亲测成功

*爱你&永不变心* 提交于 2019-12-03 03:26:50
忘了原创网址了,在 https://www.52pojie.cn/ 上看到的,这里我备忘一下,希望知道原创网址的朋友告诉我一下,谢谢! 将下面批处理脚本存成.bat文件后,以管理员方式运行: @echo off (cd /d "%~dp0")&&(NET FILE||(powershell start-process -FilePath '%0' -verb runas)&&(exit /B)) >NUL 2>&1 title Office 2019 Activator r/Piracy echo Converting... & mode 40,25 (if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in ('dir /b ..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs

VBS vs PowerShell: Which is lighter?

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: If I need a script that executes with minimum effort from the system, which would I choose? By looking at processes at Task Manager: Memory (Private Working Set) wscript.exe 2,068K powershell.exe 33,144K Thanks. 回答1: There is a conservation of work principal going on here. If the machine does less work, then you have to do more work. If the machine does more work, you have to do less work. Our philosophy with PowerShell was that the most important resource was the Admin's time and attention so we spend machine resources to deliver the best

vbs syntax error: 800A03EE ')' expected

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I try to execute this in a file called 'addcurrentkey.vbs' But it says ')' is expected in row 1. Character 38. I tried this tutorial: http://www.codeproject.com/Articles/16569/Autorun-Applications Why can't I execute a .vbs file? Private Sub AddCurrentKey(ByVal name As String, ByVal path As String) Dim key As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True) key.SetValue(name, path) End Sub 回答1: The code you posted is probably written in VB.net (or perhaps VBA). You are tying to run the code

VBS website login script - “Object required” error

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to write my first website login script but always getting an error in line 9 position 9 saying: "Object Required: 'getElementByID(...)' 800A01A8. Here's my code for the real working site so that you may have a try: Call Main Function Main Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_") IE.Visible = True IE.Navigate "https://www.valuedopinions.com/eng/signin" Wait IE With IE.Document .getElementByID("tx_voputilities_pi1[email]").value = "my@email.com" .getElementByID("tx_voputilities_pi1[password]").value =

VBS Run cmd.exe output to a variable; not text file

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This is what I have so far. It works; outputing the folder path to temp to a text file. What I really want, is to output the data to a variable. Every example I see online, show how to do this using something like: set objScriptExec = wshShell.Exec (strCommand) followed by strresult = LCase(objScriptExec.StdOut.ReadAll. // code I want this to run with Run , not Exec , because I want the command prompt windows to be hidden as I will performing many commands with the code below. How can I capture that output to a variable? Set wsShell =