vbscript - Run Command Line & Command From VBS -


i need run command copy file 1 location through command prompt using vbs file. have keeps throwing error @ me.

'dim oshell set oshell = wscript.createobject ("wscript.shell") oshell.run "cmd.exe /c copy "s:claims\sound.wav" "c:\windows\media\sound.wav" set oshell = nothing' 

the error is:

'script: c:\******\command.vbs char: 30 error: expected end of statement code: 80040401 

source: microsoft vbscript compilation error'

please :)

the problem on line:

oshell.run "cmd.exe /c copy "s:claims\sound.wav" "c:\windows\media\sound.wav" 

your first quote next "s:claims" ends string; need escape quotes around files second quote, this:

oshell.run "cmd.exe /c copy ""s:\claims\sound.wav"" ""c:\windows\media\sound.wav"" " 

you have typo in s:claims\sound.wav, should s:\claims\sound.wav.

i assume apostrophe before dim oshell , after set oshell = nothing typos well.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -