Jump to content

Need Help With Batch File Permissions (using Runonce)


spooky655

Recommended Posts

I've tried to automate a few processes such as deleting desktop icons by place .bat files on the cd and running then with the runonce option in the "unattended" section. I see the command prompt come up as it's loading the desktop for the first time, but the .bat files seem to have no affect. I try running them off the cd manually, but they still have no effect. When I copy them to the Desktop though, the work perfectly fine. I'm assuming the problem has to do with permissions and was wondering how to fix this.

EDIT: To be more specific, this happened while trying to delete with the "rd" (remove directory) command.

Edited by spooky655
Link to comment
Share on other sites


Actually I was wrong... I don't know what's wrong... Here's the .bat file:

cd "C:\Documents and Settings\Administrator\Desktop\" && rd /s . /q && cd "C:\Documents and Settings\All Users\Desktop\" && rd /s . /q && cd C:\Windows\system32\ && EmptyRecycleBin.exe /q

When I run it off the cd, nothing happens. When I copy to a folder (ex. My Documents) it deletes the icons from Administrator/Desktop, but not from All Users/Desktop.

The other problem I had was with this .bat file:

cd C:\AstonSettings\ && move Aston.7z "C:\Documents and Settings\Administrator\Application Data\Aston\" && cd "C:\Documents and Settings\Administrator\Application Data\Aston\" && 7z x Aston.7z && del Aston.7z && rd /s C:\AstonSettings\ /q

When I logon for the first time, I find that nothing has happened. When I copy the .bat file to the Desktop and run it, It works fine.

Link to comment
Share on other sites

Thanks for replying! But how exactly do I use the command (where in the batch file)? I don't know too much about using the command prompt.

btw, I made the same post in another section of the forums because I was sure if this was the right one.

Edited by spooky655
Link to comment
Share on other sites

I assume the && stands for a continue in the command line? why not separate the commands, it seems awfully long for a single command line.

you might need to activate wildcard extension. Im not on my regular computer so cant lookup any specific information atm.

Try with separating the different commands and you should be fine.

Link to comment
Share on other sites

Incase anyone wanted to see them, here are the batch files:

del /s /f /q "C:\Documents and Settings\Administrator\Desktop\*" && del /s /f /q "C:\Documents and Settings\All Users\Desktop\*"

move C:\AstonSettings\Aston.7z "C:\Documents and Settings\Administrator\Application Data\Aston\" && 7z x -y -o"C:\Documents and Settings\Administrator\Application Data\Aston\" "C:\Documents and Settings\Administrator\Application Data\Aston\Aston.7z" && del /f /q "C:\Documents and Settings\Administrator\Application Data\Aston\Aston.7z" && rd /s C:\AstonSettings\ /q

Link to comment
Share on other sites

You dont need to use the && you can just hit enter in notepad and start on new commandline =) And of course you dont need more batch files.

Why are you doing this anyway? To unpack you docs&settings user profile? Lots of stuff in there that cant be reused on reinstalls.

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