Reputation: 869
I have a batch script with 4 commands as follows
sqlcmd (truncate table in database)
del "path to existing csv to delete"
"path to my .vbs script" "file path to xls file to convert" "file path to where csv is to be created"
"File path to Python" "File path to python script to read csv into database"
It runs just fine when I double click the batch file. When I try to run the batch file from the command prompt it doesn't see the .csv file to delete, I'm not sure why this is, but I don't think it matters for my purposes.
When I run the task from task scheduler manually it truncates the table in the database and deletes the existing csv file but the new one is not created which leads me to believe it is getting stuck on the .vbs file.
I have tried making an individual task with the .vbs script and passing in the path to the .xls and .csv files as arguments, but again it just runs without stopping.
I have tried adding
@echo off
>log.txt(
the body of my batch script
)
but nothing gets written to the log. I have also tried adding cscript and also tried adding wscript at the beginning of the line in the batch file which calls the .vbs script and have tried changing the start in directory to C:\batch where the file resides.
No luck with any of the above attempts. Not sure where to go from here.
Upvotes: 1
Views: 1184
Reputation: 869
Found this 2013 answer by eric on Superuser:
Create these two folders:
32Bit:
C:\Windows\System32\config\systemprofile\Desktop
64Bit:
C:\Windows\SysWOW64\config\systemprofile\Desktop
Excel needs these folders if it's not run interactively. Create both folders even if you are on a 64-bit OS.
Upvotes: 2