How to command as root running on login?

How to command as root running on login xfce?
Added in xfce startup settings but not running
Edit:
My question is i can’t run command (A command must run with sudo)to run on startup or login? Right now i can only run it with normal command without sudo in launch-session startxfce4 and can’t run command with sudo

How to run a command with root access when logging in xfce?

Hi @Usr2023,

That’s not the best of ideas…I wouldn’t recommend it, nor what I suspect, is the answer to your suspected, not known - suspected, question.

It might help if you provide more information. Please see:

This looks awfully like an XY problem.

one explanation of that term:

XyProblem - Greg's Wiki

What is it that you want to achieve?

Ask about that,
not about how to do it the way you thought it would work, but it didn’t.

I’m sorry to asked ( create topic)the question in a hurry without explanation, from now on I will try to follow the rules of creating the topic The first post was edited

It is still the same question.

Short answer:
you don’t.

There is a command that I want to run with sudo every time login.

Yes, we got that.
But why?
What is it that that command is supposed to be doing?

sudo rm -rf ~/.cache/*

You don’t need sudo to do that.

Indeed not, because everything in your home directory is writable by you.

An alternative however could be — provided that when you log out, you also shut down the machine — to make ~/.cache a symbolic link to /tmp.

/tmp is on a tmpfs, a filesystem in virtual memory, and thus its contents do not persist across reboots. Its permissions also allow it to be written to by unprivileged users.