Jump to content

Piping with RunOnceEx


Recommended Posts

I have tried ever thing I can think of, and did some searching online, still nothing!

I am trying to use command piping with the RunOnceEx registry key, and it seems like no matter how I do it - I keep getting an error. :no:

The basic idea is to make sure the installation programs are run as a specific user that was created during the OS setup process, and that account is hidden, and has a password set to it, but I have a program that will auto answer the password entry.

Anyway the way to do this at the command prompt or inside a batch file is:

runas /u:Username filetorun | sanur password

But issue that same command using RunOnceEx and it complains.

Any clue how to make this work?

Thanks

Link to comment
Share on other sites


the problem with that solution was probably the addition of the extra quotes, which weren't necessary and if required would have needed escaping.

This should have been fine

REG ADD %KEY%\001 /V 1 /D "cmd /c runas /u:Username filetorun | sanur password" /f

Link to comment
Share on other sites

the problem with that solution was probably the addition of the extra quotes, which weren't necessary and if required would have needed escaping.

This should have been fine

REG ADD %KEY%01 /V 1 /D "cmd /c runas /u:Username filetorun | sanur password" /f

Unfortunately not that easy - but at least I got the EXACT error this time:

The format of the " sanur password" RunEx or RunOnceEx entry was invalid. A vertial bar

("|") is needed after the function name and the function needs to support WinMain()

parameters.

That's the message that just keeps popping up no matter how I try to put it in......

Link to comment
Share on other sites

Why don't you try to pre-enter your command into an expandable string:

[HKEY_CLASSES_ROOT\New Key #1]
"sample"=hex(2):63,00,6d,00,64,00,20,00,2f,00,63,00,20,00,72,00,75,00,6e,00,61,\
00,73,00,20,00,2f,00,75,00,3a,00,55,00,73,00,65,00,72,00,6e,00,61,00,6d,00,\
65,00,20,00,66,00,69,00,6c,00,65,00,74,00,6f,00,72,00,75,00,6e,00,20,00,7c,\
00,20,00,73,00,61,00,6e,00,75,00,72,00,20,00,70,00,61,00,73,00,73,00,77,00,\
6f,00,72,00,64,00,00,00

If you add that to your registry, the vertical bar character will be displayed just fine.

The long hex(2)-string actually stands for "cmd /c runas /u:Username filetorun | sanur password" without the quotes.

My example is taken from a .reg file but you should be able to add that long hex(2)-string using the reg command as well.

Just don't let the \ linefeed characters confuse you!

Link to comment
Share on other sites

Unfortunately not that easy - but at least I got the EXACT error this time:

The format of the " sanur password" RunEx or RunOnceEx entry was invalid. A vertial bar

("|") is needed after the function name and the function needs to support WinMain()

parameters.

That's the message that just keeps popping up no matter how I try to put it in......

In order to run the command provided by you I have provided you with the correct syntax. If your provided information was incorrect then of course that was beyond the scope of the original question.
Link to comment
Share on other sites

Well, managed to get that to run using a different method - but that answered why the cmd /c is no good.... The point is to finish one process before starting the next - cmd /c execute the command, but dose not wait for it to finish before closing, making the app that called it, THINK the process has finished, when actually it just started!

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