Jump to content

Recommended Posts

Posted

So in my cleanup.cmd i have the following lines that arent working...

set AUStart=%AllUsersProfile%\Start Menu\Programs
set UserStart=%UserProfile%\Start Menu\Programs

MOVE /Y "%UserStart%\Internet Explorer.lnk" "%AUStart%\Internet"
MOVE /Y "%UserStart%\Outlook Express.lnk" "%AUStart%\Internet"

RD /S /Q "%AUStart%\Administrative Tools"

its not the variables because I have a ton of other shortcuts that are also being moved and folder that are being deleted. It seems as though its specific to these couple shortcuts and admin tools folder...

Any ideas?

Thanks!


Posted

closing CODE tags or QUOTE tags :P pick 1 lol

set AUStart=%AllUsersProfile%\Start Menu\Programs
set UserStart=%UserProfile%\Start Menu\Programs

maybe try

set AUStart="%AllUsersProfile%\Start Menu\Programs"
set UserStart="%UserProfile%\Start Menu\Programs"

Posted
maybe try

set AUStart="%AllUsersProfile%\Start Menu\Programs"
set UserStart="%UserProfile%\Start Menu\Programs"

That doesnt work as you end up with the quotes in your variable and again, Ive got a ton of other shortcuts and folders that are being effected using these variables without issue.

Those shortcuts are not created until you logon to desktop.

Thats probably it... anyone have a good way to clean these up, short of manually doing it after logging on?

Posted

Why not prevent them being created, in the first place using the winnt.sif components section, then just add the shortcuts to your install source for copying over

Posted

@MHz Sort of off-topic, but boy-oh-boy-oh-boy, I'd give my left pinky for a good, reliable, self-deleting batch file. Do you have something in the form of a template that you could share here?

Posted
@MHz Sort of off-topic, but boy-oh-boy-oh-boy, I'd give my left pinky for a good, reliable, self-deleting batch file. Do you have something in the form of a template that you could share here?

Um... how about...

del filename.cmd

at the end of your batch file...

Posted

@durex

Maybe the solution is far simpler:

1. If the "%AUStart%\Internet" folder is not created before moving files into it, how will the command work? :P

2. The "Administrative Tools" in start menu is actually a folder. It is enabled/disabled from registry.

Posted

filename.cmd in All Users Startup folder

@echo off
set AUStart=%AllUsersProfile%\Start Menu\Programs
set UserStart=%UserProfile%\Start Menu\Programs

MD "%AUStart%\Internet"
MOVE /Y "%UserStart%\Internet Explorer.lnk" "%AUStart%\Internet"
MOVE /Y "%UserStart%\Outlook Express.lnk" "%AUStart%\Internet"
Attrib -r "%AUStart%\startup\filename.cmd"
ShutDown.exe -s -t 10 -c "System shutdown required now. Thankyou for your patience."
Del "%AUStart%\startup\filename.cmd"

Take note of the Attrib command, the file tends to turn into read-only, when copied over during text setup.

Posted

@prathapml

Ive got many other shortcuts that are being moved to the Internet folder without issue, so I know that isnt it

@MHz

Thanks for writing that up specific to my example!

Thanks for the suggestions guys... always appreciated.

  • 2 weeks later...
Posted

After having these kinds of issues for the last ytear and a half. I was recently going through my scripts and it finally hit me what was going on.

In my case I was ceating my user accounts before I was running my cleanup.cmd. Well after tht it is to late the new users account has already been created from the default account. By the time the cleanup.cmd is running your only cleaning up the default account and the all users account and your new user has already been made from the default account before your cleaned the default account up.

So you need to reorder the way things are done. Do your cleanup and copying files and such. In my case I also do all my program installes from here so that the settings get applied to the default account also. Then as the last thing you do create your user account.

For my I'm also not using the winnt.sif. All this can be done easily from cmdlines.txt. One other thing if you do this from anything but cmdlines.txt it will be to late since the accounts will already be created. This is not so bad but it will mena that you will have more accounts to clean up.

Posted

@ web

While your setup may differ from mine, my method should effect the %userprofile% (my created account, not the default) because my cleanup.cmd is run from RunOnceEx and my accounts are created prior to RunOnceEx even running.

So my cmdlines.txt creates my accounts, runs the runonceex script (which keep in mind at the time cmdlines.txt executes it, is ONLY adding the necessary RunOnce reg entries). Assuming runonceex is the last item in cmdlines.txt your pc then reboots.

Upon the 1st reboot after running cmdlines.txt it automatically logs in using the account I created in cmdlines, before runonceex.cmd was executed, THEN starts the RunOnce install, at the end of which runs cleanup.cmd.

So you see, at this point, when cleanup.cmd runs, youve already logged in using the account you created, so the shortcuts are created under your profile (or all users), not the default.

The reason why these few shortcuts werent getting removed when my cleanup.cmd ran, is because they are actually added pretty much at the same time the desktop is drawn for the 1st time.. after the cleanup.cmd ran. So they arent effected.

Hope this clears things up!

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...