Solved

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

Posted on 2014-11-12
9
490 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
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 78

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
 

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
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 

Author Comment

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

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 78

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now