I have hunted for an answer to my problem for two days. Yes I looked through previous asked questions on StackOverflow.
I am using a variable in a batch file.
set WorkingPath = "C:\Users\Workingpath\"
for /R %WorkingPath% %%? IN (*.txt) do (
echo Current Variable %%~f?
cmd /k Powershell.exe -executionpolicy remotesigned -File .\PowerShellFeature.ps1 -input %%~f?
)
I put an echo to prove that %%~f?
does have a variable before sending it to PowerShell. However, passed to this cmdlet:
Param(
[Parameter(Mandatory=$true)]
[string]$input
)
Write-Host "Current input: " $input
$variable = Get-Item -Path $input
$date = $variable.LastWriteTime
No matter how I format the PowerShell parameters I get error "-input is null". I've tried using different variable types for the parameter.
If PowerShell had a recursive find I could just do it in PowerShell but recursive find is CMD function.