Below is the line in my power shell script where I call the batch file(with parameters) and I get a positional parameter error.
Could someone please help on how to call a batch file with parameters from a powershell script and how to capture that input parameter from batch file. Thanks
Line in my Power shell script:
Start-Process "cmd.exe" "/c D:\load.bat" "$Password"
--Error:
**PS D:\Oracle\Scripts\Obi> .\XYZ.ps1
Start-Process : **A positional parameter cannot be found that accepts argument 'password'.**
At D:\.ps1:4 char:1
+ Start-Process "cmd.exe" "/c D:\load.bat" "$Password"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand**
Script in Batch file (load.bat):
set "Var=%1"
for %%i in (*.csv) do (
sqlldr USERID=userid/%Var%@server:prot/domain, CONTROL=control.ctl, LOG=logfile.log,ERRORS=9999 data='%%i' direct='true'
move %%i D:\backup
)