Solved

Batch file to delete a folder in windows 7 , when the PC restarts.

Posted on 2014-11-12
9
555 Views
Last Modified: 2014-12-10
Hi

I want to delete a folder in windows 7 when this PC restarts.The folder is located in the following location .

C$\ProgramData\Microsoft\Windows\Start Menu\Programs\Technology\Textile Technology

I will create a GPO and i will apply this batch file to a GPO (Computer configuration-policies- windows settings-Scripts-shutdown)

Please post me a syntax for a batch file;
 

Any help much appreciated, thanks guys.
0
Comment
Question by:lianne143
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 

Expert Comment

by:angelfyre
ID: 40437929
Create any file name with the extension .bat

Insert the following line:

rd /s /q C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Technology\Textile Technology


This will remove the directory with the contents, in quiet mode, not asking you for confirmation.
0
 
LVL 22

Expert Comment

by:plusone3055
ID: 40437949
rmdir /s /q "C:\TestingThe BatchFile"
0
 
LVL 80

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 250 total points
ID: 40438107
another approach

rd /s /q "%programdata%\Microsoft\Windows\Start Menu\Programs\Technology\Textile Technology"
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lianne143
ID: 40438951
Thanks David it worked like a Charm , it deleted the Textile Technology folder.

Finally I want to add another line to create a folder called "Food Technology" under the following location and want to copy a shortcut within this  Food Technology folder.

C$\ProgramData\Microsoft\Windows\Start Menu\Programs
0
 

Author Comment

by:lianne143
ID: 40438991
Thanks for your help so far.
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 250 total points
ID: 40445796
Please note that "C$\ProgramData\Microsoft\Windows\Start Menu\Programs" is not really a location - "\\MyPC\C$\ProgramData\Microsoft\Windows\Start Menu\Programs" or "C:\ProgramData\Microsoft\Windows\Start Menu\Programs" is ...

All you need to add for creating the folder is a similar md (mkdir) command for the new folder (and I strongly recommend to use the %programdata% syntax, but be aware that only works for 32bit OS, or 64bit programs on 64bit OS, else paths are different):
rd /s /q "%programdata%\Microsoft\Windows\Start Menu\Programs\Technology\Textile Technology"
md "%programdata%\Microsoft\Windows\Start Menu\Programs\Food Technology"
copy "\\server\share\shortcut.lnk" "%programdata%\Microsoft\Windows\Start Menu\Programs\Food Technology\"

Open in new window

I've used "\\server\share\shortcut.lnk" as the source of the shortcut. Change that as required.
0
 
LVL 59

Expert Comment

by:LeeTutor
ID: 40488548
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
LVL 80

Expert Comment

by:David Johnson, CD, MVP
ID: 40488549
there is more than enough informatrion: accept qlemo's last comment ID: 40445796 and my comment (assisted) ID: 40438107
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question