Reputation: 40982
I am trying to open a CMD
window and call dir in it.
r = Shell("cmd.exe", vbNormalFocus)
AppActivate r
SendKeys "dir", True 'put your exe path/name here instead of dir
SendKeys "{ENTER}"
It opens cmd.exe
but doesn't print dir
in it or execute dir
at all.
Upvotes: 0
Views: 104
Reputation: 47945
Why don't you simple call:
r = Shell("cmd.exe /k dir", vbNormalFocus)
This call will execute the dir command in cmd for you without playing with SendKeys.
Upvotes: 2