我可以直接从命令行运行 vbscript 命令吗(即没有 vbs 文件)? [英] can I run vbscript commands directly from the command line (i.e. without a vbs file)?

查看:40
本文介绍了我可以直接从命令行运行 vbscript 命令吗(即没有 vbs 文件)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Python 中,您不必使用文件,您可以指定 -c "..." 并通过命令行上的字符串将 Python 命令提供给 Python 解释器.>

我可以用 vbscript 达到同样的结果吗?我见过需要您使用批处理脚本的解决方案,但是如果我在一个写权限为零的系统上呢?

按照@Syberdoor 的回答,我可以运行这个:

mshta vbscript:Execute("dim result:result=InputBox(""message"",""title"",""input"")(window.close):echo result")

但它仍然没有在控制台中打印结果.

解决方案

您可以使用一种技巧,那就是 mshta.exe.你可以像这样执行代码:

mshta vbscript:Execute("<你的代码在这里,用 :(冒号)>:close")

这当然是一个非常疯狂的黑客攻击,而且在一个甚至不允许您创建文件的系统上,我不确定是否允许使用 mshta.exe.

也许您还可以从 this thread (mshta 解决方案也发布在那里).尽管主要与批处理相关,但它是一种很好的概要,介绍了几种非常疯狂的方法来欺骗 Windows 执行 vbs 代码.

In Python you are not obliged to use a file, you can specify -c "..." and gives the Python commands to the Python interpreter via a string on the command line.

Can I achieve the same result with vbscript? I've seen solutions that need you to use a batch script, But what if I am on a system with zero writing permissions?

Following the answer from @Syberdoor, I can run this:

mshta vbscript:Execute("dim result:result=InputBox(""message"",""title"",""input"")(window.close):echo result")

but it still doesn't print the result in the console.

解决方案

There is one trick you can possibly use and that is mshta.exe. You can execute code like this:

mshta vbscript:Execute("<your code here, delimit lines with : (colon)>:close")

This is of course a fantasticly insane hack and on a system where you are not even allowed to create a file I am not sure if mshta.exe would be allowed.

Maybe you can also find additional inspiration from this thread (the mshta solution is also posted there). Although mostly batch related it is imo a great compendium of several really crazy ways to fool windows into executing vbs code.

这篇关于我可以直接从命令行运行 vbscript 命令吗(即没有 vbs 文件)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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