Jump to content

Question on batch file?


Recommended Posts

Posted

There is a command as show below for my batch file

DELTREE /y C:\CWIN98\tempor~1

After running this batch file, and refresh the window explorer for this

folder, I still can see files inside this directory. Will it be refresh

problem?

On the other hands, I would like to delete the folder UserData without any

request for confirmation if it exists under C:\WIN98\UserData.

Does anyone have any suggestions on how to write the code on batch file?

Thanks in advance for any suggestions

Eric

  • Replies 3
  • Created
  • Last Reply
Guest philo
Posted

Re: Question on batch file?

 

 

"Eric" <Eric@discussions.microsoft.com> wrote in message

news:CA214A6B-2A8B-4E8D-9562-E9EA40B49FDF@microsoft.com...

> There is a command as show below for my batch file

> DELTREE /y C:\CWIN98\tempor~1

> After running this batch file, and refresh the window explorer for this

> folder, I still can see files inside this directory. Will it be refresh

> problem?

> On the other hands, I would like to delete the folder UserData without any

> request for confirmation if it exists under C:\WIN98\UserData.

> Does anyone have any suggestions on how to write the code on batch file?

> Thanks in advance for any suggestions

> Eric

 

 

To view all valid switches for any executable simply use: /?

 

 

Viz: deltree /?

 

 

It appears that you have made a typo

 

as in your first example you show your windows folder as being "CWIN98"

 

and in your second example "WIN98"

 

Obviously you chose a customized install location...but only you would know

the correct path

Posted

Re: Question on batch file?

 

Eric, try this as the last line of your AUTOEXEC.BAT file:

 

deltree /y "%winbootdir%\Temporary Internet Files\*.*"

 

Reason it goes in the autoexec.bat file (as LAST LINE) is because

Windows will not allow you to delete the internet directory as long as

Windows is open. It's a protected directory! Upon boot Windows will

automatically rebuild the directory. (BTW: you may want to copy and

paste to avoid typos)

___

 

"Eric" <Eric@discussions.microsoft.com> wrote in message

news:CA214A6B-2A8B-4E8D-9562-E9EA40B49FDF@microsoft.com...

> There is a command as show below for my batch file

> DELTREE /y C:\CWIN98\tempor~1

> After running this batch file, and refresh the window explorer for

this

> folder, I still can see files inside this directory. Will it be

refresh

> problem?

> On the other hands, I would like to delete the folder UserData without

any

> request for confirmation if it exists under C:\WIN98\UserData.

> Does anyone have any suggestions on how to write the code on batch

file?

> Thanks in advance for any suggestions

> Eric

Posted

Re: Question on batch file?

 

None, quoting long file names won't work in the autoexec.bat file

because DOS doesn't do long file names even if they are quoted.

Quoted long file names only work inside of Windows' DOSboxes because

that environment is actually an emulator and NOT DOS to start with.

DOS does not run under any 9x Windows as often spouted by those who

really don't know, but instead Windows is a 32 bit OS that can emulate

a 16 bit DOS with a DOSbox quite well. And when it does that, you get

long file name support via quotes only.

 

But good detective work otherwise...

 

Eric, the reason your method did not work is because you did it in a

Windows DOSbox and when Windows is working, that folder is protected

and DOS can not delete it when Windows is using it. Windows is always

using that folder so it must deleted from true DOS mode at boot up

time. Move your deltree line into your autoexec.bat file and it will

work just fine.

 

The /y switch makes the deltree command not show a conformation box

so:

if exist C:\WIN98\UserData\nul deltree /y C:\WIN98\UserData

 

This will delete the folder UserData. If you wanted to just delete

the files inside the UserData folder despite any attributes you would

do this instead:

if exist C:\WIN98\UserData\nul deltree /y C:\WIN98\UserData\

 

That simple backslash at the end saves the folder itself from

deletion, but all other subfolders and files will be gone no matter

what attributes they may carry.

 

 

On Apr 13, 4:34 pm, "none" <nos...@bogusaddress.com> wrote:

> Eric, try this as the last line of your AUTOEXEC.BAT file:

>

> deltree /y "%winbootdir%\Temporary Internet Files\*.*"

>

> Reason it goes in the autoexec.bat file (as LAST LINE) is because

> Windows will not allow you to delete the internet directory as long as

> Windows is open. It's a protected directory! Upon boot Windows will

> automatically rebuild the directory.  (BTW: you may want to copy and

> paste to avoid typos)

> ___

>

> "Eric" <E...@discussions.microsoft.com> wrote in message

>

> news:CA214A6B-2A8B-4E8D-9562-E9EA40B49FDF@microsoft.com...

>

>

>

> > There is a command as show below for my batch file

> > DELTREE /y C:\CWIN98\tempor~1

> > After running this batch file, and refresh the window explorer for

> this

> > folder, I still can see files inside this directory. Will it be

> refresh

> > problem?

> > On the other hands, I would like to delete the folder UserData without

> any

> > request for confirmation if it exists under C:\WIN98\UserData.

> > Does anyone have any suggestions on how to write the code on batch

> file?

> > Thanks in advance for any suggestions

> > Eric- Hide quoted text -

>

> - Show quoted text -


×
×
  • Create New...