Sign in to follow this  
Followers 0
Skizz

Simple script

9 posts in this topic

Aight, quick question, I am creating an exe which contains a password to execute a program for users that do not have admin rights. The password contains an ' which is giving me issues in my script. any ideas? the code is pretty simple:

RUN(@ComSpec & 'runas /user:username password' & "'" & ' program')

Thanks!

Share this post


Link to post
Share on other sites



Try

RUN(@ComSpec & 'runas /user:username password' & "''" & ' program')


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Try

RUN(@ComSpec & 'runas /user:username password' & "''" & ' program')
It still doesnt like it.

Share this post


Link to post
Share on other sites

How about

RUN(@ComSpec & "runas /user:username password" & "'" & " program")

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Run(@ComSpec & ' /c runas /user:username password "program"')

Edit:

typos fixed

use /c for line command mode

Edited by MHz

Share this post


Link to post
Share on other sites

What do you want to do will not work until you

a) use proper cmd-syntax

; close cmd after exec
RUN(@ComSpec & ' /k XXX') 
; leave it open
RUN(@ComSpec & ' /c XXX')
oÝ÷ ØÞ¸­z»§jƭ欴z-±ç*Z²Ì(­Ø§¶¬Ê{ZÅˬzØb±«­¢+Ø)Õѽ%ÑMÑ=ÁÑ¥½¸ ÌäíQÉå%½¹ÕÌäì°Ä¤(()%UÍÉ9µ±ÐìÐìÌäíµ¥¹¥ÍÑÉѽÈÌäìQ¡¸í
¡¬½ÈÁ½ÝÈ($I¥½¸´´´
½]¥éɹÉѽMÑÉд´´($í%¹ÁÕÑ ½àÑÕÉÌèQ¥Ñ±õeÌ°AɽµÁÐõeÌ°Õ±ÐQáÐõ9¼($ÀÌØíµ¥¹AÍÌô%¹ÁÕÑ  ½à Ìäí%¹ÁÕÐÌäì°Ìäí¥µµÑ¡ÁÍ̸Ìäì°ÌäìÌäì°Ìäì¨Ìäì°Ìäì´ÄÌäì°Ìäì´ÄÌäì°Ìäì´ÄÌäì°Ìäì´ÄÌäì¤(%M±Ð($%
ÍÉɽÈôÀí=,´Q¡ÍÑÉ¥¹ÉÑÕɹ¥ÌÙ±¥($$%IÕ¹ÍMÐ Ìäíµ¥¹¥ÍÑÉѽÈÌäì°
½µÁÕÑÉ9µ°ÀÌØíµ¥¹AÍ̤($$%%
½µÁ¥±Q¡¸($$$%IÕ¸ ÌäìÅÕ½ÐìÌäìµÀìMÉ¥ÁÑÕ±±AÑ µÀìÌäìÅÕ½ÐìÌäìµÀìÀÌØíµ¥¹AÍ̤($$%±Í($$$%IÕ¸ ÌäìÅÕ½ÐìÌäìµÀìÕѽ%ÑáµÀìÌäìÅÕ½ÐìÅÕ½ÐìÌäìµÀìMÉ¥ÁÑÕ±±AÑ µÀìÌäìÅÕ½ÐìÌäìµÀìÀÌØíµ¥¹AÍ̤($$%¹%($$%%ÉɽÈQ¡¸5Í    ½à ÐÀäجÌÈ°ÌäíÉɽÈÌäì°ÌäíÉɽÈÍÑÉÑ¥¹Õ¹Èµ¥¸µ½Ìäì¤($$%á¥Ð($%
ÍÉɽÈôÄíQ¡
¹°ÕÑѽ¸ÝÌÁÕÍ¡($$%á¥Ð($%
ÍÉɽÈôÌíQ¡%¹ÁÕÑ    ½à¥±Ñ¼½Á¸($$%á¥Ð(%¹M±Ð($¹I¥½¸´´´
½]¥éɹÉѽ¹´´´)±Í(ìAÕÐå½Õȵ¥¸µ½¡ÉÌÌìÌÌìÌÌì(%5Í ½à À°Ìäí$´Ìäì°UÍÉ9µ¤)¹%$

Share this post


Link to post
Share on other sites

someone correct me if I'm wrong but I didn't think runas.exe alllowed you to store the password? ie you had to type it in everytime?


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

someone correct me if I'm wrong but I didn't think runas.exe alllowed you to store the password? ie you had to type it in everytime?

Okay, getting pretty close by assigning variables, but now it just gives me the runas functions?!?

$user = "test"
$password = "Password's"
RUN(@ComSpec & ' /k runas' & ' /user:' & $user & ' ' & $password & ' C:\Temp\CAPTURE.EXE')
Edited by Skizz

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

The more I think about it the more I'm very sure you can't enter a password into runas.exe....

Which means the best way I can think of to do it would be;

$user = "user"
$password = "password"
Run(@COMSPEC & ' /c runas /user:'&$user&' notepad')

And then have autoit send the $password var to the dos window. I tried to send keystrokes to the window but it didn't work although I know I've seen people do that so I would suggest in lack of a better option to try doing it this way

EDIT- I apologize I assumed that since skizz posted again that something still wasn't working, but dabus' code looks like it should work... didn't mean to step on your toes

Edited by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
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
Sign in to follow this  
Followers 0