kncowans
(Getting the hang of it)
2002-11-12 03:10 PM
Deleting a directory named %WinDir%

Hello all

For some reason, a directory named %WinDir% has appeared on all of my client machines with a blank text file inside it.

Obviously I am unable to delete this directory using the Del C:\%WinDir% command but how would I accomplish this?

Thanks in advance


Sealeopard
(KiX Master)
2002-11-12 03:15 PM
Re: Deleting a directory named %WinDir%

Try replacing the '%' sign with it's ASCII code like
code:
if exist('c:\'+chr(37)+'WINDIR'+chr(37))
del 'c:\'+chr(37)+'WINDIR'+chr(37)
endif

Alternatively, temporarily point the environment variable %WINDIR% to the real folder C:\%WINDIR%, delete the folder and the repoint %WINDIR% to the correct Windows directory.

However, the question is, why has the folder been created in the first place?


Richard H.Administrator
(KiX Supporter)
2002-11-12 03:24 PM
Re: Deleting a directory named %WinDir%

At a DOS prompt or batch file:
code:
DEL %%WINDIR%%\blankfile.txt
RD %%WINDIR%%

Use a similar syntax in KiXtart - using "%%" cancels the special meaning of "%".


kncowans
(Getting the hang of it)
2002-11-12 03:42 PM
Re: Deleting a directory named %WinDir%

Hello

Thanks for the replies, however, none of the above solutions work.

Any more suggestions?

Thanks in advance

Kevin


Sealeopard
(KiX Master)
2002-11-12 03:51 PM
Re: Deleting a directory named %WinDir%

Go to one of the affected computers and check the permissions. Then try to manually delete the folder through the Windows Explorer. Then try to delete such a folder form the command line.

kncowans
(Getting the hang of it)
2002-11-12 03:54 PM
Re: Deleting a directory named %WinDir%

Hello

All of the machines with this directory are Windows '98SE.

I can delete the directory if I right click and select delete.

Thanks in advance

Kevin


BrianTX
(Korg Regular)
2002-11-12 03:55 PM
Re: Deleting a directory named %WinDir%

Is this Windows NT or Windows 9x?

Brian


kncowans
(Getting the hang of it)
2002-11-12 03:59 PM
Re: Deleting a directory named %WinDir%

Hello

These are Windows '98SE machines.

Thanks in advance

Kevin


Richard H.Administrator
(KiX Supporter)
2002-11-12 04:28 PM
Re: Deleting a directory named %WinDir%

quote:
Thanks for the replies, however, none of the above solutions work.
Eh? Are you sure?

What error messages are you getting back when it doesn't work?

I've just tried it on a Win95 machine:
code:
md c:\%%WINDIR%%

Creates the directory, and
code:
rd c:\%%WINDIR%%

removes it.
You will need to remove the file from the directory before attempting to delete the directory itself, but other than that it should work.

[ 12. November 2002, 16:31: Message edited by: Richard Howarth ]


kncowans
(Getting the hang of it)
2002-11-12 04:36 PM
Re: Deleting a directory named %WinDir%

Hello

I have just tried it again and that worked, thanks.

Bye for now

Kevin


Les
(KiX Master)
2002-11-12 04:37 PM
Re: Deleting a directory named %WinDir%

Maybe attributes on file or folder? Try DelTree.