bobheart Posted June 18, 2004 Share Posted June 18, 2004 (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 June 18, 2004 by bobheart Link to comment Share on other sites More sharing options...
bobheart Posted June 18, 2004 Author Share Posted June 18, 2004 (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 June 18, 2004 by bobheart Link to comment Share on other sites More sharing options...
midiaxe Posted June 18, 2004 Share Posted June 18, 2004 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") Link to comment Share on other sites More sharing options...
bobheart Posted June 18, 2004 Author Share Posted June 18, 2004 It ran with no errors but didn't print out any txt . Link to comment Share on other sites More sharing options...
midiaxe Posted June 18, 2004 Share Posted June 18, 2004 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 More sharing options...
bobheart Posted June 18, 2004 Author Share Posted June 18, 2004 Yes I got that error too till i did what is in the first code I did . Link to comment Share on other sites More sharing options...
bobheart Posted June 18, 2004 Author Share Posted June 18, 2004 I got the exe from here .http://www.sysinternals.com/ntw2k/source/misc.shtml#hostname Link to comment Share on other sites More sharing options...
midiaxe Posted June 18, 2004 Share Posted June 18, 2004 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 More sharing options...
bobheart Posted June 18, 2004 Author Share Posted June 18, 2004 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 More sharing options...
bobheart Posted June 18, 2004 Author Share Posted June 18, 2004 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 More sharing options...
midiaxe Posted June 18, 2004 Share Posted June 18, 2004 (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 June 18, 2004 by midiaxe Link to comment Share on other sites More sharing options...
bobheart Posted June 18, 2004 Author Share Posted June 18, 2004 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 More sharing options...
midiaxe Posted June 18, 2004 Share Posted June 18, 2004 I'm glad it works for you. Inserting double quotes (") in a string sometimes confuses me. Glad I could help... =MX= Link to comment Share on other sites More sharing options...
RocTx Posted June 18, 2004 Share Posted June 18, 2004 Try putting the "HostName.exe" file in your path (Windows directory) should work. It should execute just fine without having to specify the path. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now