MacGyver80
asked on
VB Script to ask for input where a file name would go
My company is working on creating RSA tokens for Android. In order to create the token we go through the whole process of creating from the server but then we have to download and convert the token using an application and command-line.
I need assistance in creating a script that will allow me to enter the token name instead of having to type in the whole command everytime.
Command:
TokenConverter "FILENAME.sdtid" -android -o tokenfile.txt
I would like the script to run this command but prompt for the Filename.sdtid so that it can be entered and then processed.
I'm new to scripting so I'm not even sure where to begin with this.
Any assistance would be appreciated.
I need assistance in creating a script that will allow me to enter the token name instead of having to type in the whole command everytime.
Command:
TokenConverter "FILENAME.sdtid" -android -o tokenfile.txt
I would like the script to run this command but prompt for the Filename.sdtid so that it can be entered and then processed.
I'm new to scripting so I'm not even sure where to begin with this.
Any assistance would be appreciated.
ASKER
It's Windows 7, so even a Powershell or VB would be helpful
ASKER
So I took the first script and made it in to a batch file, named it ConvertMyToken.bat. Then, I took the 2nd and made it in to a bacth file and named it mycnv.bat. I then launched the ConvertMyToken.bat and a command prompt appeared and then immediately closed.
ASKER
This is what I started off using:
@echo off
c:\Token_Converter\TokenCo nverter TokenName.sdtid -android -o tokenfile.txt
But if I can get it to prompt for the token name instead of me having to put it in to the actual script every time it would save a lot of time.
@echo off
c:\Token_Converter\TokenCo
But if I can get it to prompt for the token name instead of me having to put it in to the actual script every time it would save a lot of time.
You don't have to put it in the script. My version uses %1, which gets replaced by the 1st parm from the command line. So this script:
when it is run like this:
actually runs like this
TokenConverter "FILENAME.sdtid" -android -o tokenfile.txt
TokenConverter "%1" -android -o tokenfile.txt
when it is run like this:
mycnv FILENAME.sdtid
actually runs like this
TokenConverter "FILENAME.sdtid" -android -o tokenfile.txt
ASKER
Forgive my lack of knowledge with scripting but I'm lost. Are you saying all I have to put in to the batch file is
1: echo off
2:
3: TokenConverter "%1" -android -o tokenfile.txt
because it doesn't work. It will open a the command prompt very quickly and then close without doing anything.
1: echo off
2:
3: TokenConverter "%1" -android -o tokenfile.txt
because it doesn't work. It will open a the command prompt very quickly and then close without doing anything.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for MacGyver80's comment #a39642483
for the following reason:
I found the information myself and compiled the bat file in to an .EXE
Accepted answer: 0 points for MacGyver80's comment #a39642483
for the following reason:
I found the information myself and compiled the bat file in to an .EXE
Objection:
Your posted solution might be what you used in the end, but never asked for. The similarity to what I've posted (and my posted being a direct response to your request as defined last), I cannot accept your final disposition. We can't help you with something you don't tell us, and what you have got was the best we could do under that circumstances.
Your posted solution might be what you used in the end, but never asked for. The similarity to what I've posted (and my posted being a direct response to your request as defined last), I cannot accept your final disposition. We can't help you with something you don't tell us, and what you have got was the best we could do under that circumstances.
ASKER
I've requested that this question be deleted for the following reason:
Found the answer myself through web searching
Found the answer myself through web searching
ASKER
Thanks for the suggestions Qlemo. I was able to expand very much based off of that.
Open in new window
That %1 gets replaced with the first parameter that gets passed to the batch file. So if you name the batch file mycvt.bat, your conversion command becomes:
Open in new window