wshshell how can we use variable value in .Run
i want to read file line by line and want to use each line as argument in below lines.
Set objIniFile = objFSO.OpenTextFile( "C:\Users\rahulsh\Desktop\inputfile.txt",ForReading, False )
Do While objIniFile.AtEndOfStream = False
strLine = Trim( objIniFile.ReadLine )
WshShell.Run "cmd /k shutdo开发者_开发技巧wn -m \\ **-add ""strLine"""**
if I understand correctly, this is just a string concatenation of the computer name of the /m
option of the shutdown
command
Set objIniFile = objFSO.OpenTextFile( "C:\Users\rahulsh\Desktop\inputfile.txt",ForReading, False )
Do While Not objIniFile.AtEndOfStream
strLine = Trim( objIniFile.ReadLine )
WshShell.Run "cmd /k shutdown -m \\" & strLine
loop
assuming that strLine will only contain your computer name
精彩评论