Jump to content

How can you remove "desktop.ini" from the desktop?


Recommended Posts

I am running a CMD file on first logon. This CMD file has the "restart in 120 seconds" command first of all, then it waits 90 seconds so Vista has a chance to fully log in. After the 90 seconds is up, the next commands are like this to delete the desktop.ini file:

ATTRIB -S -H -R "%USERPROFILE%\Desktop\desktop.ini"
ATTRIB -S -H -R "%SYSTEMDRIVE%\Users\Public\Desktop\desktop.ini"
ATTRIB -S -H -R "%SYSTEMDRIVE%\Users\Administrator\Desktop\desktop.ini"

DEL /F /S /Q "%USERPROFILE%\Desktop\desktop.ini"
DEL /F /S /Q "%SYSTEMDRIVE%\Users\Public\Desktop\desktop.ini"
DEL /F /S /Q "%SYSTEMDRIVE%\Users\Administrator\Desktop\desktop.ini"

Even though this 90 second wait is easily long enough (it probably logs in fully after

about 30 seconds) and I can see the desktop.ini file there, this command is not

deleting the file. If I let it reboot and run the above command, it does delete the

file... does anyone know where I am going wrong or why it is not deleting the file?

ATTRIB -S -H -R means take off the "hidden/system/read only" attributes, so its

not because its a hidden system file... maybe I could put a 5 second wait between

the commands like this:

ATTRIB -S -H -R "%USERPROFILE%\Desktop\desktop.ini"
ATTRIB -S -H -R "%SYSTEMDRIVE%\Users\Public\Desktop\desktop.ini"
ATTRIB -S -H -R "%SYSTEMDRIVE%\Users\Administrator\Desktop\desktop.ini"

SLEEP 5

DEL /F /S /Q "%USERPROFILE%\Desktop\desktop.ini"
DEL /F /S /Q "%SYSTEMDRIVE%\Users\Public\Desktop\desktop.ini"
DEL /F /S /Q "%SYSTEMDRIVE%\Users\Administrator\Desktop\desktop.ini"

But I have a feeling this has nothing to do with it since on XP I have removed

attributes and had the DEL command right after it with no problems.

This isn't a case of it recreating the file on reboot - because I can see the file

there and the command does not delete it.

Link to comment
Share on other sites


Are you running as an Admin?

Yes.

or is that a reg tweak disabling UAC is not applied till after reboot?

Reg tweaks are applied the exact same time this command runs so,

no it has not rebooted to let them take effect, I wonder how you can

do a reg import before that like with XP @ T-12 minute stage...

Or is that acctually Firstlogoncommands which run as the Admin

Yes, its under <FirstLogonCommands> which is why it has to sleep a while

before it logs in... otherwise I think its trying to apply reg settings too soon.

Is it probably UAC thats the reason for this file not deleting?

Link to comment
Share on other sites

not if you using <FirstLogonCommands> cause thats like disabling the UAC during that cmd/exe or script but once it stops you don't have the power anymore.

I usually delay about a minute before my desk fully loads, of course that will vary.

Reason I get those desktop.ini on desk is setting view all files, includes sys, hidden. Then theres 2 on desk and I just manually delete

Link to comment
Share on other sites

Reason I get those desktop.ini on desk is setting view all files, includes sys, hidden. Then theres 2 on desk and I just manually delete

Yeah thats the only reason they are visible for me, I am setting tweaks to

show all files.. all meaning.. ALL.

Its weird... it takes about 30 seconds to log in and I have set it to sleep

for 90 seconds, the CMD that runs the delete command kicks in after about

75 seconds so thats 45 seconds after it has finished logging in... maybe I

could just not set it to show all hidden system files but I didn't really want

to do that... I like being able to see pagefile.sys and anything else thats

there... although saying that, there are a lot of strange shortcuts on the C

drive that you cannot even access, those wouldn't show if the tweak was

removed and I guess it looks a lot more tidy too.

Its always the principle of it with me though, none of this solves the problem

of why that desktop.ini can't be deleted on the first login! I can manually

run the commands in the first post on the first login no problem and it deletes

the file.

I suppose Vista is protecting itself somehow, which I can't complain about. :rolleyes:

Edited by LeveL
Link to comment
Share on other sites

SLEEP 5

surely you copy sleep.exe to system32 with Oems?

Otherwise it may need a full path if located with cmd

but you did say it was delaying

things still to figure out with this vista for sure

Edited by maxXPsoft
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...