Sign in to follow this  
Followers 0
Metaborn

OpenRemoteHostRoot

2 posts in this topic

I always forget \\HOSTNAME/c$ when I need to use it.

Plus I was bored

CODE

#cs ----------------------------------------------------------------------------

Author: Joshua McTyre

Version: 1.0.0

Date: 10/03/07

AutoIt Version: 3.2.6.0

License: http://www.gnu.org/copyleft/gpl.html

Script Function: To open root on a remote system

I always forget how to open C:/ on a remote machine,

aka run this: \\HOSTNAME/c$

So I made this.

#ce ----------------------------------------------------------------------------

#NoTrayIcon

Opt("RunErrorsFatal", 1)

Opt("MustDeclareVars", 1)

main()

Func main()

Local $hostname

Local $cmd

Local $result

Local $msg

;;; Prompt for Hostname

$msg = "To open C:/ on a remote machine " & @CRLF & "enter its hostname or IP Address." & @CRLF & @CRLF & "Leave it blank to open yours."

$hostname = InputBox("Prompt for Hostname", $msg)

;;; If the user enters no hostname, then use localhost

If $hostname == "" Then

$hostname = @ComputerName

EndIf

;;; Running $cmd

$cmd = "Start " & "\\" & $hostname & "/c$"

$result = RunWait(@ComSpec & " /c " & $cmd, "", @SW_HIDE)

;Success: Returns the exit code of the program that was run. Success == 0

If $result <> 0 Then

ConsoleWriteError("Error: RunWait() returned a bad exit code: " & $result & @CRLF)

EndIf

ConsoleWrite($cmd & @CRLF)

EndFunc

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