2 of 2 people found this helpful
hey Mark. there is no specific forum for tabcmd (yet), however many of these questions are posed within the serveradmin forum right now.
To answer your question, I do have a daily export where I append the date onto the file. Here it is, the %ldt% is a variable that has the date in the format yyyy-mm-dd
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
tabcmd export "/workbook/view?:refresh=yes" -f "\\UNC\path\filename-%ldt%.pdf" --fullpdf
Thanks Jeff. After I posted this I found a ton of info similar to what you've posted. It's all new to me though, so i still have some questions.
I ran your code and i got a "%%i was unexpected at this time." error. Here's the full command I ran:
** for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
tabcmd export "/WORK-1234/456?Provider%20Group=PSY" -f "\\DeptShares\Phys\PSY-%ldt%.pdf" --pdf **
See anything wrong? What does the "/F" notate?
Edit - I've discovered that since I'm using command line directly then I need to use only one '%', so the error mentioned above is gone, but I cannot get the date to actually append. Instead it appends "%ldt----.pdf"
1 of 1 people found this helpful
ah yes. Shell scripting has some peculiarities. If you are trying to run the command interactive inside of a command prompt, you should have one % instead of %% everywhere. But if you create a shell command script and run it in batch mode, then it needs two %%. Does this make sense?
And if you want to know what the "/F" indicates, within a command window, just type for /?, and it will provide you help on the entirety of the command. Or this is good too. For /f - Loop through text | Windows CMD | SS64.com
Ok, the problem was that I had a double %% hiding that I couldn't find at first. Changed to % and it's working! Thanks for the link and your help.
Jeff, I'm looking around, but having trouble seeing how to manipulate the date output so that it would read something like "June 2016" if ran in July. So subtract one from current month and put it in the nice format.
I don't know how to get the actual text in there of June, but if you want something like 6/2016, then you could do this.
for /F "usebackq tokens=1,2 delims==" %i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%i.'=='.LocalDateTime.' set ldt=%j
set /a "ldtmonth=%ldt-month% - 1"
I can't quite get this one to work, but I'll keep playing around with it. Thanks again.
I did it interactive, so if you want to do it in a batch script, add th %% back in