I try to send second command to cmd. in cmd maybe i should do this
Microsoft Windows [Version 10.0.14986]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>D:
D:\>set /p a=Write a text :
Write a text : This is a sample
D:\>echo %a% > sample.txt
D:\>type sample.txt
This is a sample
D:\>
Change to drive D > set a variable > write the answer > write it to a file and read it.
inline code is :
cmd.exe /c "D: & set/p a=write a text : & echo %a% > sample.txt & type sample.txt & pause"
its sucks when i want to use it in VB Script. while i try to get command, i will take it out to file. But how if there is a input request like :
Press any key to continue...
Are you sure you want to continue? (Y/n)
Ping an IP : (xxx.xxx.xxx.xxx)
and when i send command to it. it will auto exit if its finish the task like
CreateObject("WScript.Shell").run "cmd.exe /c ping google.com > myfile.txt
'After finish pinging it will auto exit.
And my question are, how i send input to cmd. And how i KEEP the cmd still live
Any ideas?
Oh ya. I wont to use batch-file to execute it.