Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Script or Batch that removes an older version of install file

Posted on 2011-04-29
9
Medium Priority
?
225 Views
Last Modified: 2012-06-27
we use a Software that updates the security on programs. Each time an update is ready, it gets provided by that software vendor which is then ready to install.

the problem is that the patch always has the same name and therefore the patching is not effective.To avoid this,i need to get the old file renamed and removed.

How would a patch or script look like which renames the old "update.exe" into say,"updateold.exe", then deletes it and installs the new one instead?
0
Comment
Question by:quickslvr
  • 6
  • 3
9 Comments
 
LVL 8

Expert Comment

by:steinmto
ID: 35491131
Are you looking for a login script?
0
 

Author Comment

by:quickslvr
ID: 35491233
no, a script or batcvh which exactly the above: rename,delete
0
 
LVL 8

Expert Comment

by:steinmto
ID: 35491267
RENAME [drive:][path]filename1 filename2.
REN [drive:][path]filename1 filename2.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

rename c:\win.exe c:\win.old
del c:\win.old

Is that what you want?
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:quickslvr
ID: 35491383
thats the idea. is there another way of doing it?

what are these DEL attributes exactly?
0
 
LVL 8

Accepted Solution

by:
steinmto earned 2000 total points
ID: 35491486
You can use vbscript but I think a simple batch file would do it.

I ran
rename c:\win.exe win.old
del c:\win.old
as test.bat and it worked ok
0
 
LVL 8

Expert Comment

by:steinmto
ID: 35491492
I created a file called win.exe in the root of my c:drive and it renamed it and deleted it.
0
 

Author Comment

by:quickslvr
ID: 35491597
ok,ill try it and let you know.

what are these DEL attributes exactly?
0
 
LVL 8

Expert Comment

by:steinmto
ID: 35491644
Don't use
rename c:\win.exe c:\win.old
del c:\win.old

Use
rename c:\win.exe win.old
del c:\win.old

I had the syntax wrong in the top one.
0
 
LVL 8

Expert Comment

by:steinmto
ID: 35491654
DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

  names         Specifies a list of one or more files or directories.
                Wildcards may be used to delete multiple files. If a
                directory is specified, all files within the directory
                will be deleted.

  /P            Prompts for confirmation before deleting each file.
  /F            Force deleting of read-only files.
  /S            Delete specified files from all subdirectories.
  /Q            Quiet mode, do not ask if ok to delete on global wildcard
  /A            Selects files to delete based on attributes
  attributes    R  Read-only files            S  System files
                H  Hidden files               A  Files ready for archiving
                I  Not content indexed Files  L  Reparse Points
                -  Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:

The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
MS Outlook undoubtedly is the most widely used email client.Its user-friendliness, cost effectiveness, and availability with Microsoft Office Suite make it the most popular email application.  Its compatibility with Microsoft applications like Exch…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

571 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