Sign in to follow this  
Followers 0
bobheart

I would like to do this but do not know how to .

14 posts in this topic

#1 ·  Posted (edited)

But I have this and it works great but I would like to be able to at a domain name in a input box so I don't have to hard code it .

I know how to save it to a txt file but it would be nice if I could show back in the input box so it can be copyed .

Run("HOSTNAME.EXE  www.google.com >hostname.txt")
Edited by bobheart

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Ok I got this to work but can't get it to print to txt ? and I know all never get it to print back to the input box. lol

$answer = InputBox("Question", "Will give domain name ip number ", "http://www.google.com", "", -1, -1, 30, 30)
Run("HOSTNAME.EXE $answer, >hostname.txt")

Will I guess I can't tell if it is working till I see it print something out so I don't know if this is working but I get no errors .

Edited by bobheart

Share this post


Link to post
Share on other sites

Try this code:

$answer = InputBox("Question", "Will give domain name ip number ", "http://www.google.com", "", -1, -1, 30, 30)
Run("HOSTNAME.EXE " & $answer & " >hostname.txt")

Share this post


Link to post
Share on other sites

It ran with no errors but didn't print out any txt .

Share this post


Link to post
Share on other sites

Try this:

$answer = InputBox("Question", "Will give domain name ip number ", "http://www.google.com", "", -1,-1, 30, 30)
$str = @Comspec & " /c HOSTNAME.EXE " & $answer & " > hostname.txt"
Run($str)

On my XP Pro machine, hostname.exe does not accept any parameter. When I run "hostname.exe" it only displays my computer name. If I run the script above, it creates an empty hostname.txt file.

Try this code and see if you get an error message at the DOS prompt

$answer = InputBox("Question", "Will give domain name ip number ", "http://www.google.com", "", -1,-1, 30, 30)
$str = @Comspec & " /k HOSTNAME.EXE " & $answer & " > hostname.txt"
Run($str)

Error in DOS prompt:

sethostname: Use the Network Control Panel Applet to set hostname.

hostname -s is not supported.

Share this post


Link to post
Share on other sites

Yes I got that error too till i did what is in the first code I did .

Share this post


Link to post
Share on other sites

I see what you're trying to do. You need to fully qualify the path for the HOSTNAME.EXE that you downloaded. Something like:

$answer = InputBox("Question", "Will give domain name ip number ", "http://www.google.com", "", -1,-1, 30, 30)
$str = @Comspec & " /c C:\Temp\Download\HOSTNAME.EXE " & $answer & " > hostname.txt"
Run($str)

Share this post


Link to post
Share on other sites

Now that worked if you just use www.google.com where the http gives an error . how can I use it but not have the full path to the hostname.exe . just so it reads it from the folder that au3 will be in ?

Share this post


Link to post
Share on other sites

I tried this but didn't work .

$answer = InputBox("Question", "Will give domain name ip number ", "http://www.google.com", "", -1,-1, 30, 30)
$str = @Comspec & " /c @ScriptDir HOSTNAME.EXE " & $answer & " > hostname.txt"
Run($str)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

This works on my machine. You need to make sure that your HOSTNAME.EXE is in the same directory where your script resides:

$answer = InputBox("Question", "Will give domain name ip number ", "www.google.com", "", -1,-1, 30, 30)
$str = @Comspec & " /c """ & @ScriptDir & "\HOSTNAME.EXE"" " & $answer & " > hostname.txt"
Run($str)
Edited by midiaxe

Share this post


Link to post
Share on other sites

Yes that works .. it just took the """ it looks like to make it work .. I just don't know where to put " and $ and % stuff. lol

Thank you for the help ..

Share this post


Link to post
Share on other sites

I'm glad it works for you. Inserting double quotes (") in a string sometimes confuses me. Glad I could help...

=MX=

Share this post


Link to post
Share on other sites

Try putting the "HostName.exe" file in your path (Windows directory) should work.

It should execute just fine without having to specify the path.

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