SOW,
Not sure why you are double-quoting your batch file name, unless it actually resides in a directory path which has embedded spaces.
If your directory path does not have embedded spaces, this will work:
wshshell.run "C:\qat.bat " & a
(ensure a space before the last double-quote and then append the variable a.)
If your directory path DOES have embedded spaces (eg, "f dir" below) then try this:
wshshell.run """C:\temp\f dir\doit.bat"" " & a
(ensure you double-up the double-quotes around the fullpath filename to the batch file.
And this will work whether you have spaces in the path or not)
In any case, it appears that your double-quote within your batch file also needs some fixing up...the double-quotes for the target file do NOT need double-spaces, unless the actual filename will have embedded spaces.
If target file will NOT have spaces in the name, this will work:
copy ss.txt + tt.txt %1.txt
If target file WILL have spaces in the name, then there will be more than one arg to the batch, so use %* to get them all, and put double-quotes after the file extension:
copy ss.txt + tt.txt "%*.txt"
(This will work whether you have spaces in the target filename or not)
Hope this helps.
Vieditorlover,
Thanks for that reply. I'm quite new to scripting and I was getting compilation error. Could please explain it in bit detail..
I will tell you the scenario and the example code i'm taking here..
My .vbs file has the following code :
dim a
dim WshShell
a=inputbox("Server Name:")
if (a= "" )then
Msgbox "Please give correct input"
Else
set WshShell=Wscript.Createobject("Wscript.shell")
wshshell.run """C:\qat.bat""" ' Here I want to pass variable a
End if
My .bat file code can as simple as
@echo off
copy ss.txt + tt.txt "%1".txt
How to use your answer in this scenario??