Jump to content

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


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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)
Link to comment
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 ?

Link to comment
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)
Link to comment
Share on other sites

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
Link to comment
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 ..

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...