Last active
April 23, 2018 17:25
-
-
Save operatorequals/366988e600f671ba08b0a334ece70cc4 to your computer and use it in GitHub Desktop.
VBS script to Auto Open Microsoft Word
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start winword |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set shell = WScript.CreateObject("WScript.Shell") | |
' Looks for Microsoft Office Word Executable | |
Set resp = shell.exec("cmd.exe /c cd C:\\ && dir winword.exe /s/b ") | |
word = resp.StdOut.ReadAll() | |
' Modifies the path to not contain CRLF | |
segm = Split(word, vbcrlf) | |
' Creates the command to be run in shell | |
word = "cmd /c " & chr(34) & segm (0) & chr(34) | |
' Runs the shell object with the specified Exe Path | |
shell.exec( word ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment