Batch file not removing old icon when installing

prayder

New member
Local time
9:51 AM
Messages
4
My batch files keep creating a duplicate icon when they are ran. Instead of replacing the existing icon it just adds another one to my desktop. How can I fix this? Here is what one of my files look like:

ECHO OFF
@echo "Waiting for Position Matrix to shut down"
c:
cd\
mkdir databases
C:
cd\databases
del Inventory_mgr.mdb
o:
CD\WWP Shared\Databases
ECHO ON
echo "PLEASE WAIT WHILE FILES ARE BEING COPIED!!!"
echo "This box will close upon completion!!!!"
ECHO OFF
copy Inventory_mgr.mdb C:\databases
copy FREE3OF9.ttf c:\databases
CD\WWP Shared\Databases\icons
Copy Inventory_mgr.ico c:\databases
CD\WWP Shared\Databases\shortcuts
copy Inventory_mgr.lnk c:\databases
rem *******************************************
rem Window 7 fix
c:
cd\
cd databases
copy Inventory_mgr.lnk %userprofile%\Desktop
rem *****************************************
rem windows xp
c:
cd \
cd documents and settings
cd all users
cd desktop
copy c:\databases\Inventory_mgr.lnk
C:\databases\Inventory_mgr.mdb

rem ************************************************




I have also posted this same request at http://forums.windowsforum.org/index.php?showtopic=51332
 
Last edited:

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 64bit
Code:
rem *******************************************
rem Window 7 fix
c:
cd\
cd databases
[COLOR="Red"]copy Inventory_mgr.lnk %userprofile%\Desktop[/COLOR]
rem *****************************************
rem windows xp
c:
cd \
[COLOR="red"]cd documents and settings
cd all users
cd desktop
copy c:\databases\Inventory_mgr.lnk[/COLOR]
C:\databases\Inventory_mgr.mdb

rem ************************************************

Your code appears to purposely create two shortcuts to the desktop.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
Back
Top