i have a problem with executing native dos shell comands like "echo"
"echo text > $INSTDIR\location.txt" written in the shell/command line of windows results in the creation of a file that contains "text"
while trying to have similar result from with a nsis script i tried
Exec "echo $INSTDIR > $INSTDIR\location.txt"
Exec '"echo" $INSTDIR > $INSTDIR\location.txt'
even
Exec '"command.com" echo $INSTDIR > $INSTDIR\location.txt'
and the file is never created
can anyone help ?
executing dos commands
27 posts
if all you're trying to do is put the instdir variable into a file, try using the file functions.
FileOpen $0 "filename" w
FileWrite $0 "$INSTDIR"
FileClose $0
-Tim
FileOpen $0 "filename" w
FileWrite $0 "$INSTDIR"
FileClose $0
-Tim
can anyone help me with this, i didnt want to make a topic with almost the same name
im making a script to run cmd.exe then runas.exe with some parameters, the problem is, the runas.exe program asks for the admin password, how can to write the pass in the script and hit enter?
im making a script to run cmd.exe then runas.exe with some parameters, the problem is, the runas.exe program asks for the admin password, how can to write the pass in the script and hit enter?
You'll have to use Windows API (System plug-in) to similate key events (SendKeys).
Can't him do that using SendMessage, Joost? Or that is the only one way to do that?
Joost, please explane how "to similate key events (SendKeys)". User has handle for running DOS (console) process, how to send key?
BTW, with Windows API it is possible to create DOS application (run runas.exe with parameters) with redirected IO using pipes, this case application waits for WriteFile() output (with password, for example), such plug-in might be usefull.
BTW, with Windows API it is possible to create DOS application (run runas.exe with parameters) with redirected IO using pipes, this case application waits for WriteFile() output (with password, for example), such plug-in might be usefull.
If you can get it to work using the console you can always call the console with a command using Exec.
I have no time to write complete Windows API examples, sorry.
I have no time to write complete Windows API examples, sorry.
Sorry, my English is very very poor.
If your "runas.exe" is a dos program and it totally only need input this 2 things just like this:
If your "runas.exe" is a dos program and it totally only need input this 2 things just like this:
then you can make a text file (ex: QUOTE.TXT) with 3 line like this:
Username:
Password:
line 1:somebody this is username stringafter that, use a I/O redirect to input those for you.
line 2:12345678 this is password string
line 3: this line have nothing here. You must keep this blank line here for input [Enter] key
...
exec '"$Sysdir\cmd.exe" "fullpath\runas.exe" < "fullpath\Quote.txt"'
...
s793016
I/O redirection with < and > works fine on Linux, and on some of Wins too, but unfortunately, not on all :-(( This is why I had to to use correct rediriction with pipes in my applications.
I/O redirection with < and > works fine on Linux, and on some of Wins too, but unfortunately, not on all :-(( This is why I had to to use correct rediriction with pipes in my applications.
the way to exec a dos command like echo:
cmd.exe /K echo Hello World
/C - Carries out the command specified by string and then terminates
/K - Carries out the command specified by string but remains
and u would have to use command.com on 9x ofcourse
cmd.exe /K echo Hello World
/C - Carries out the command specified by string and then terminates
/K - Carries out the command specified by string but remains
and u would have to use command.com on 9x ofcourse
Originally posted by Takhircan you explain to me how you did it? please.. =)
s793016
I/O redirection with < and > works fine on Linux, and on some of Wins too, but unfortunately, not on all :-(( This is why I had to to use correct rediriction with pipes in my applications.
Originally posted by Andersit doenst work
the way to exec a dos command like echo:
cmd.exe /K echo Hello World
/C - Carries out the command specified by string and then terminates
/K - Carries out the command specified by string but remains
and u would have to use command.com on 9x ofcourse
tried
runas /user:localhost\user "program" /K password
i/o redirect sample
a bit of code.
((pthreadParams)ptp)->rq(hInputWrite, hOutputRead, ((pthreadParams)ptp)->param);
is a call to program, which handles child process i/o (like lgOutput() sub).
More info u can find in MSDN.
a bit of code.
((pthreadParams)ptp)->rq(hInputWrite, hOutputRead, ((pthreadParams)ptp)->param);
is a call to program, which handles child process i/o (like lgOutput() sub).
More info u can find in MSDN.
Re: i/o redirect sample
isnt there a easier way to do what i want? how that API thing works?
Originally posted by Takhiri wish i knew more... i really cant understand your program..
a bit of code.
((pthreadParams)ptp)->rq(hInputWrite, hOutputRead, ((pthreadParams)ptp)->param);
is a call to program, which handles child process i/o (like lgOutput() sub).
More info u can find in MSDN.
isnt there a easier way to do what i want? how that API thing works?
If you want to use redirection, these examples from the "Help w/ mysql script" thread might help:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
Drako12: Please note - C code is attached to previous post as io.txt file.
And BTW instead of using FileOpen, Write, Close (treehousetim post) it might be better to include password file to package and to use it from tmp folder (don't copy to $INSTALL).
And BTW instead of using FileOpen, Write, Close (treehousetim post) it might be better to include password file to package and to use it from tmp folder (don't copy to $INSTALL).
Originally posted by pengyou
If you want to use redirection, these examples from the "Help w/ mysql script" thread might help:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
http://forums.winamp.com/showthread....64#post1302664
i tried with a file something like this
runas /user:localhost\user "program" < C:\x.txt
where x has the password
but i get an error , it says "RUNAS cannot accept this input" or something like that
Originally posted by Takhir
Drako12: Please note - C code is attached to previous post as io.txt file.
And BTW instead of using FileOpen, Write, Close (treehousetim post) it might be better to include password file to package and to use it from tmp folder (don't copy to $INSTALL).
i understand C, but i cant understand what you program does =/
If you only need to ask for a password from the DOS api take a look here, its works fine:
Now my next question, I use Exec for running a DOS command, is it somehow possible to avoid that the DOS box opens and closes? thanxs
cheers,
alej
Now my next question, I use Exec for running a DOS command, is it somehow possible to avoid that the DOS box opens and closes? thanxs
cheers,
alej
NSIS ExecShell (as I can see in exec.c) is implemented using ShellExecute API call. ShellExecute supports more "show modes", then you can see in NSIS docs, try one of them: SW_HIDE (0)
Cool it works! But in which docu does this mode appear, not on the NSIS User Manual. Are there any other docus? thanxs!
cheers,
alej
cheers,
alej
ups did not know that it was microsofts shellexecute! thanxs!
Is it possible to execute dos commands using ExecShell? I tried the following:
ExecShell open "net use ..." SW_HIDE
and
ExecShell open "cmd.exe net use ..." SW_HIDE
it doesn't give any error but it doesn't execute it. Exec works fine but I don't want that the dos box appears upon execution and the 'hide' option is not available for exec right? thanxs
ExecShell open "net use ..." SW_HIDE
and
ExecShell open "cmd.exe net use ..." SW_HIDE
it doesn't give any error but it doesn't execute it. Exec works fine but I don't want that the dos box appears upon execution and the 'hide' option is not available for exec right? thanxs
Voilá!