Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
pass parameter to batch script
Name: newtechie Date: December 12, 2007 at 14:24:44 Pacific OS: win server 2003 CPU/Ram: p3 Product: dell
Comment:
i'm writing a script that needs to call another script called "backup.bat". when backup.bat is invoked, it asks for a password which I want to hardcode in my script so I can run it in background without invoking the user.
Name: tonysathre Date: December 12, 2007 at 14:53:39 Pacific
Reply:
Post the code for the 2 scripts.
"Computer security." — Oxymoron
0
Response Number 2
Name: newtechie Date: December 12, 2007 at 15:16:40 Pacific
Reply:
wrapper script: cd "C:\Program Files\Product group\Product name"
backupAllData.bat -backup
original script output:
Dec 12, 2007 3:14:19 PM com.product.BackupTool main INFO: args[0]=-backup
Enter the user's password: ********
this is the point where the user is supposed to enter the password - i want to hardcode this part
backupAllData.bat is just invoking a java classfile and i dont have access to the code, only the class file and the script invoking the classfile I've modified product names/titles for security purposes
0
Response Number 3
Name: tonysathre Date: December 13, 2007 at 05:05:16 Pacific
Reply:
If the program doesn't have a switch to allow you to script it, I don't think you could do it with built-in commands. You could probably use expect.exe to accomplish what you need.
If you have trouble learning the syntax of expect, try autoexpect.exe which records what you do, in your case inputting a password and such, and saves it in an expect script. You will have to specify the UNC path to the exe on a server in your batch script: \\server\share\expect.exe [params]
Unless you push out the exe to your clients with a GPO.
"Computer security." — Oxymoron
0
Response Number 4
Name: Razor2.3 Date: December 13, 2007 at 11:42:49 Pacific
Reply:
(echo 3 echo 1 echo 2) | sort
I'm not saying this method would work, but it's probably your best chance.
Summary: to pass parameters to an exe you use ParamStr(n) and ParamCount (use delphi help). If you don't want to use DOS command prompt to pass the parameters use a shortcut, and then right click, and add your...
Summary: @echo off copy %1 %2 unshrink %2 copy %2 %3 call the batchfile with the following paramters. For eg.the batch file is saved as copybatch.bat copybatch.bat c:\1234\*.* c:\unshrink\*.* c:\dest it will...