我可以编写来调用批处理脚本的最简单的程序是什么?
Windows 不允许您将批处理文件添加到快速启动或 Windows 7 中调用的任何内容,这是非常愚蠢的。 横栏对面的栏,我可以在那里附加 Firefox、命令提示符,甚至画图(我最喜欢的),但不能一个批处理文件。我可以将它“固定”到另一个程序,这很奇怪。我希望它独立,批处理文件本身就可以完成足够的工作。
假设我有批处理文件。我可以编写来调用所述脚本的最简单的可执行程序是什么?然后我终于可以将所有有用的批处理文件固定在那个快速跳转固定栏上。
It is very stupid that windows will not let you add batch files to your quick launch or whatever they call in in windows 7. That bar across the bar, i can attach firefox there, command prompt, even paint (my favorite), but not a batch file. I can "pin" it to another program, which is just weird. I want it to standalone, the batch file does enough work by itself.
So lets say i have batch file. What is the simplest executable program I can write to invoke said script. Then I can finally pin all my useful batch files on that quick-jump-pin-bar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果我没记错的话,您可以通过首先将 CMD.exe 的快捷方式固定到任务栏来完成此操作。然后编辑命令,将
CMD.exe
更改为CMD.exe /c MyBatchFile.bat
。我相信这将执行批处理文件。If I remember right, you can do this by first pinning a shortcut to CMD.exe to the taskbar. Then edit the command, and change
CMD.exe
toCMD.exe /c MyBatchFile.bat
. I believe this will execute the batch file.由于您只能固定一个 cmd,因此假设您安装了 .NET 框架,这里有一种替代方法 - 一个非常简单的 C# 应用程序:
使用以下内容填充文本文件:
其中
Program
是可执行文件的名称您想要创建,c:\test.bat
是批处理文件的完整路径。将文件另存为Program.cs
。从命令行执行以下命令:您可以将
2.0.50727
替换为计算机上存在的任何目录 - 可能是 1.1.something 或 3.5 或 4.0.something - 对于此场景来说都是相同的。这将生成 Program.exe。您可以将该 exe 文件放在任何您想要的位置,并将该可执行文件固定到任务栏。制作完可执行文件后,您可以丢弃 .cs 文件。
这是一个蹩脚的解决方案,但假设您没有找到更好的解决方案,它应该可以工作。如果您没有 .NET 框架(我不确定在 Windows 7 中是否可能),您可以非常轻松地安装它。
Since you can only pin one cmd, here's an alternative, assuming you have the .NET framework installed - a very simple C# application:
Populate a textfile with the following contents:
where
Program
is the name of the executable you want to create, andc:\test.bat
is the full path to the batch file. Save the file asProgram.cs
. Execute the following from the command line:You can replace
2.0.50727
with whatever directory exists on your machine - might be 1.1.something or 3.5 or 4.0.something - it's all the same for this scenario.This will generate Program.exe. You can put that exe file wherever you want, and pin that executable to the taskbar. You can discard the .cs file once you're done making your executables.
Kind of a crappy solution, but it should work, assuming you don't find anything better. And if you don't have the .NET framework (which I'm not sure is even possible in Windows 7), you can install it pretty easily.
最简单的方法是创建一个文件夹,将批处理文件放入其中,然后将文件夹固定到菜单栏:D
您还可以编写启动脚本,这样批处理文件将在启动时执行,但我不知道如果您想在每次启动时运行这些脚本...您还可以将命令提示符添加到栏中,并编辑启动路径..
The easiest way is to create a folder, put your batch files in it, and pin the folder to the menu bar :D
You can also write a startup script, so the batch file will be executed on startup, but I don't know if you want to run those scripts on every bootup... You can also add the command prompt to the bar, and edit the startup path..
在 CMD 上使用命令开关.exe。
Use command switches on CMD.exe.
作为一种解决方法,您可以使用以下技巧。将任意应用程序固定到任务栏,按住 Shift 键并右键单击固定图标,选择属性,相应地更改“目标”和“开始于”。如果您愿意,也可以将其重命名。
您可以使用这一技术固定多个 .bat 文件。
As a sort of workaround you could use the following trick. Pin an arbitrary application to the task bar, Shift+right click on the pinned icon, select Properties, change 'Target' and 'Start in' accordingly. Rename it too if you like.
You can pin more than one .bat file using this technique.