Run Vbs File From Cmd Peru
I am new to scripting ,vbs and HTA commands but I have tryed to create a simple hta folder with some text boxes that represent a date and the current time and I need to run a specific cmd command that takes that date/hour and use them in the specified commad.I think you will understand more when you read the code.I appologise in advance for the mistakes.
Hey, thanks for the rapid responses.I have managed to get it to run a part of what i want.The part of settime.sh was actually a command in putty and i didn't quite realise it at the moment of writing but i have managet to get it to a point where it runs putty when I press the run button.Now I need it to type in the command with the values given by the user in the text boxes.This is what I have so far: HTA Test
1 Answer
I see several mistakes in the above statement:
- There's a spurious
WScript
. CMD.EXE
doesn't have an option/g
. Did you mean/c
?.sh
is an extension typically used for Linux/Unix shell scripts. Windows batch files have the extension.bat
or.cmd
.- VBScript doesn't expand variables inside strings, so you need to concatenate your variables with the string literals.
Also, I'd append , 0, True
to the statement, so that the CMD
instance runs hidden and the code waits for the external command to complete.
Try this:
Not the answer you're looking for? Browse other questions tagged vbscriptscriptingcmdhta or ask your own question.
I need to run a command to copy a file from one location to another through Command Prompt using a vbs file. this is what I have however it keeps throwing an error at me.
The error i get is:
Source: Microsoft VBScript compilation error'
Please help :)
2 Answers
The problem is on this line:
Your first quote next to 'S:Claims' ends the string; you need to escape the quotes around your files with a second quote, like this:
You also have a typo in S:ClaimsSound.wav
, should be S:ClaimsSound.wav
.
I also assume the apostrophe before Dim oShell
and after Set oShell = Nothing
are typos as well.