批处理文件有问题

发布于 2024-07-13 14:23:13 字数 913 浏览 5 评论 0原文

我创建了一个批处理文件来卸载我的应用程序。 我的问题是,结果是,此卸载删除了一些文件,但保留了其他文件。

例如,我在 C:\\Documents and settings\User-Name\myCompanyName\My Application name\ 中创建了一个文件夹 该文件夹包含我的应用程序的所有文件。 现在,当我卸载时,所有这些文件都被删除。 但我也想从“C:\Documents and settings\User-Name”中删除“myCompanyName”文件夹

与前一个问题相关的另一个问题是我在开始菜单中添加了一个名为 myComapny 它包含 4 个文件:

  1. exe 文件、
  2. 配置文件
  3. 、帮助文件和
  4. 卸载文件。

当我单击卸载文件时,它会删除所有内容,但仍然保留开始菜单中包含我刚才的四个文件的文件夹列出。

如何通过批处理文件删除不需要的文件夹?

这是我的批处理文件代码:

   @echo off
   msiexec /x {DD75996F-C279-420A-9A19-48EF9EFE70C2} 

   RD /s "C:\Program Files\ASGATech"
   RD /s "C:\Documents and Settings\%userprofile%\start menu\programs\ASGATech"
   pause

注意:我尝试将批处理文件的扩展名从 bat 更改为 cmd 我还尝试让当前登录用户 %userprofile% 转到他/她的开始菜单。 如果此方法有误,请告知我。

I created a batch file, to uninstall my application. My problem is that as result, this uninstallation deleted some files but kept others.

For example one, I created a folder in C:\\Documents and settings\User-Name\myCompanyName\My Application name\
This folder contains all files for my application. Now when I uninstall, all these files are deleted. But I want to delete "myCompanyName" folder too from "C:\Documents and settings\User-Name"

The other problem tied with the previous one is that I added a new folder to the start menu called myComapny It holds 4 files:

  1. exe file
  2. config file
  3. help file, and
  4. uninstall file

When I click on the uninstall file, it removes everything but still keeps the folder in the start-menu containing the four files I just listed.

How could I delete the unwanted folders through the batch file?

Here is my batch file code:

   @echo off
   msiexec /x {DD75996F-C279-420A-9A19-48EF9EFE70C2} 

   RD /s "C:\Program Files\ASGATech"
   RD /s "C:\Documents and Settings\%userprofile%\start menu\programs\ASGATech"
   pause

NOTE: I tried to change the extension of the batch file from bat to cmd
I also tried to get the current login user %userprofile% to go to his/her start menu. If this way is wrong, please inform me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉栀 2024-07-20 14:23:13

删除 C:\Documents and Settings - 它已位于 %userprofile% 标记中。

RD /s“%userprofile%\开始菜单\程序\ASGATech”

Remove the C:\Documents and Settings - this is already in the %userprofile% tag.

RD /s "%userprofile%\start menu\programs\ASGATech"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文