Run batch file on specific directory Task Scheduler? / Set directory in NodeJS scripts?
Closed this issue · 1 comments
Hello, love the project and it works great. I was wondering if there was a way for me to have this run as a task for a specific folder. I am savvy with Batch files and PowerShell, but not so much with Nodejs. I have tried to CD or pushd within the batch, not that I thought that it would work, but I tried regardless.
I appreciate any help/thoughts that anyone might have. And I don't expect a full working code, just a pointer on what I would need to do or change to do this.
Figured it out on my own using Powershell to call the batch file, passing the directory. Had to have Powershell re-name files with spaces, otherwise it would error out. Running this as a task
$path = "L:\Download"
Get-ChildItem
Start-Sleep -Seconds 10
foreach ($file in (Get-ChildItem -Path $path -Recurse))
{
$Full = $file.FullName
start-process 'cmd.exe' '/c C:\Path\To\Batch\batch.bat', $Full
Start-Sleep -Seconds 5
}