Accidental Hyper-V Administrator
asked on
Need to modify a working VBScript to use variables
Hello again everyone,
RobSamson was kind enough to author a VScript for me.
It works great and I am very pleased.
Here's what the short script looks like:
Set objShell = CreateObject("WScript.Shel l")
strCommand = "cmd /c C:\BETASys\exf.exe -c ""C:\BETASys\BETASys.md5"" > ""%USERPROFILE%\AppData\Lo cal\Test\I ntergrity_ check_resu lts.txt"""
objShell.Run strCommand, 1, True
Now, I should like to request a bit of help modifying RobSamson's work some. (If I might.)
The current script has three parameters:
The first parameter is the location and name of an executable that I want to run:
C:\BETASys\exf.exe
The second parameter is the location and name of an input file, that the executble in the first parameter will use:
-c ""C:\BETASys\BETASys.md5
And the thrid parameter, is where to send the output when the executable defined in the first parameter is run.
> ""%USERPROFILE%\AppData\Lo cal\Test\I ntergrity_ check_resu lts.txt"""
Now for my issue:
The folder locations for the first two parameters could be different each time I run this script.
What I would like to do (if it makes sense) is ....
Early in the script, I will populate a variable with what I want the first parameter to look like.
And I'll do the same for the second parameter.
I have some VBScript skills and I can do this.
Assuming the first variable is named "var1" and the second, is named "var2", how would I use var1 and var2, in the current line of strCommand = "cmd /c C:\BETASys\exf.exe -c ""C:\BETASys\BETASys.md5"" > ""%USERPROFILE%\AppData\Lo cal\Test\I ntergrity_ check_resu lts.txt""" ?
Does that makes sense ?
........
........
Yes.
Yes, I think it does.
Thank so very much for any replies.
Good morning.
RobSamson was kind enough to author a VScript for me.
It works great and I am very pleased.
Here's what the short script looks like:
Set objShell = CreateObject("WScript.Shel
strCommand = "cmd /c C:\BETASys\exf.exe -c ""C:\BETASys\BETASys.md5""
objShell.Run strCommand, 1, True
Now, I should like to request a bit of help modifying RobSamson's work some. (If I might.)
The current script has three parameters:
The first parameter is the location and name of an executable that I want to run:
C:\BETASys\exf.exe
The second parameter is the location and name of an input file, that the executble in the first parameter will use:
-c ""C:\BETASys\BETASys.md5
And the thrid parameter, is where to send the output when the executable defined in the first parameter is run.
> ""%USERPROFILE%\AppData\Lo
Now for my issue:
The folder locations for the first two parameters could be different each time I run this script.
What I would like to do (if it makes sense) is ....
Early in the script, I will populate a variable with what I want the first parameter to look like.
And I'll do the same for the second parameter.
I have some VBScript skills and I can do this.
Assuming the first variable is named "var1" and the second, is named "var2", how would I use var1 and var2, in the current line of strCommand = "cmd /c C:\BETASys\exf.exe -c ""C:\BETASys\BETASys.md5""
Does that makes sense ?
........
........
Yes.
Yes, I think it does.
Thank so very much for any replies.
Good morning.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Happy to help. Thanks for the grade. :^)
ASKER
You are the greatest !