从 USB 复制 .bat 并将其复制到启动文件夹脚本 - WinXP
我是一名 Mac/iPhone 开发人员,所以我不太了解 Windows 脚本编写... 关键是我必须在许多计算机上安装启动应用程序,所以我想要一个带有两个 .bat 文件的 USB 记忆棒:
- 实际的“应用程序”
- 将是从我的计算机上复制第 1st.bat 的脚本USB 到 Windows 启动文件夹...
我该怎么做?
我的 USB 的名称是“USB”,我的启动应用程序的名称是“startup.bat”。 我已经说过了,我在 Windows 编程方面非常蹩脚,而且我非常需要它;)
非常感谢!
I'm a Mac/iPhone dev so I don't know very much about Windows scripting...
The point is I have to install a startup app on many computers, so I'd like to have a USB stick with two .bat files:
- would be the actual "app"
- would be the script that would copy the 1st.bat off my USB to the Windows startup folder...
How can I do that?
the name of my usb is "USB" and the name of my startup app is "startup.bat".
How I already said, I'm extremely lame in Windows programing, and I need it acutely ;)
Thanks A LOT!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试以下脚本。这将导致应用程序在当前用户登录时运行。如果没有管理权限,您将无法一次性为所有用户执行此操作。
每行执行以下操作:
Try the following script. This will cause the application to run whenever the current user logs in. Without administrative privilages, you won't be able to do it for all users in one go.
Each line does the following:
我不想将 Hand-E-Food 的答案归功于我,但我弄清楚了为什么他的代码不起作用,而且我无法回复他的答案,所以就在这里。不要在
Copy
行中的%StartupFolder%
变量周围使用引号,而是在Set StartupFolder
的路径周围使用引号。因此,代码如下。我发现这一点的唯一原因是因为它也没有为我做任何事情,所以我尝试删除
%StartupFolder%
周围的引号,这导致了错误消息它找不到该文件夹,但至少我知道它最后正在做一些事情。一旦我发现它正在寻找错误的文件夹,因为它认为文件夹名称停在其名称中的第一个空格处,我只需添加引号即可,瞧!I don't want to take credit for Hand-E-Food's answer, but I figured out why his code didn't work and I can't reply to his answer, so here it is. Instead of using quotes around the
%StartupFolder%
variable in theCopy
line, use them around the path forSet StartupFolder
. Therefore, the code would be as follows.The only reason I figured this out is because it wasn't doing anything for me either, so I tried removing the quotes around
%StartupFolder%
and that resulted in an error message that it couldn't find the folder, but at least I knew it was doing something at the end. Once I figured out that it was looking for the wrong folder because it thought the folder name stopped at the first space in its name, I simply added in the quotes and voila!试试这个(将 app.bat 替换为您实际应用程序的名称)。这应该适用于 Windows 2000 及更高版本。
Try this (replace app.bat with whatever your actual app is called). This should work on Windows 2000 and up.