Adding today's date to export file

41 views
Skip to first unread message

Unhappy Buckaroo

unread,
Sep 19, 2025, 5:16:14 PM (7 days ago) Sep 19
to GAM for Google Workspace
We have a batch file used to create new users, and I'm trying to append the date to the file when printing each user's info to a text file (ie. Roberts, Bob_20250919.txt). The .bat file reads as follows:

set fdate=%date:~10,4%%date:~4,2%%date:~7,2%

gam redirect stderr ./!Staff_Update_errors10.txt loop !Staff_Update.csv gam redirect stdout '~~DisplayName~~_%fdate%.txt' multiprocess info user ~Mail fields suspended,organizations,address,phones,org

When running the tbatch command gam tbatch date_test.bat
I get the following error:
Command: >>>set<<<  fdate=%date:~10,4%%date:~4,2%%date:~7,2%
ERROR: Invalid argument: Expected <set keyword value>)>
ERROR: batch file: date_test.bat, not processed, 1 error

If I change the set command to
set fdate %date:~10,4%%date:~4,2%%date:~7,2%
the command runs, but no file is created.

I can't figure out where I'm going wrong. I can give the variable fdate a static value, but I can't give it the computer's date value.

Ross Scroggs

unread,
Sep 19, 2025, 5:25:47 PM (7 days ago) Sep 19
to google-ap...@googlegroups.com
Drop the multiprocess, send me a private Meet/Zoom invitation.

Ross
----
Ross Scroggs



https://www.facebook.com/StAlbertPublicSchools/?fref=ts#     https://www.instagram.com/accounts/login/?next=%2Fstalbertpublicschools%2F&source=omni_redirect

The content of this message is confidential. If you have received it by mistake, please inform us by an email reply and then delete the message. Please do not copy, forward, or in any way reveal the contents of this message to anyone. The integrity and security of this email cannot be guaranteed over the Internet. Therefore, the sender will not be held liable for any damage caused by the message.

--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/b9be604e-7b72-4bad-bae2-2eca3e668387n%40googlegroups.com.

Ross Scroggs

unread,
Sep 19, 2025, 5:32:21 PM (7 days ago) Sep 19
to google-ap...@googlegroups.com
Gam doesn't  know about shell commands, this won't work:
set fdate %date:~10,4%%date:~4,2%%date:~7,2%
I can add some date support.

Ross
----
Ross Scroggs


Ross Scroggs

unread,
Sep 19, 2025, 7:42:24 PM (7 days ago) Sep 19
to google-ap...@googlegroups.com
I'm adding this:

datetime %Y%m%d

gam redirect stderr ./!Staff_Update_errors10.txt loop !Staff_Update.csv gam redirect stdout '~~DisplayName~~_%datetime%.txt' info user ~Mail fields suspended,organizations,address,phones,org


Ross
----
Ross Scroggs


Ross Scroggs

unread,
Sep 21, 2025, 6:20:50 PM (5 days ago) Sep 21
to google-ap...@googlegroups.com
This is now available in 7.22.00

Ross
----
Ross Scroggs


Penner, Andrew

unread,
Sep 22, 2025, 11:19:36 AM (4 days ago) Sep 22
to google-ap...@googlegroups.com
Thanks Ross!
That works perfectly.


_________________________________________________
Andrew Penner, Technical Analyst 
St. Albert School Division 


You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/xwYdgypnAGc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/5CD1E25E-F5CB-4E27-8EB5-266102CE95F5%40gmail.com.

Jorge A. Roque Cardenas

unread,
Sep 22, 2025, 1:27:03 PM (4 days ago) Sep 22
to google-ap...@googlegroups.com
check this out
::: show date in default locale format
echo  " %date% 
22/09/2025
::: Get date part from %date% output
:::Year %date:~6,4%
:::Month %date:~3,2%
:::Day %date:~1,2%
set "fdate=%date:~6,4%%date:~3,2%%date:~1,2%" 
 :::show custom format date
echo %fdate%
20250922





Saludos cordiales.
--------------------------------------------------

Jorge Arturo Roque Cárdenas
ANALISTA DE MESA DE AYUDA SOFTWARE DE PRODUCTIVIDAD
Celular +52 1 229 206 8511
Reserva cita aquí 
Prol. Av.Salvador Díaz Mirón 4751. Col. Las Antillas. C.P. 91836. Veracruz,Ver. MX



NOTA DE CONFIDENCIALIDAD: Este mensaje y los archivos anexos, en caso de que existan, contienen información de la Empresa Remitente que es confidencial y para uso exclusivo de la persona o entidad de destino. Debido a que puede contener información privilegiada, confidencial o que de alguna manera está protegida contra su distribución no autorizada, agradecemos que si ha recibido este correo electrónico por error, notificarlo de manera inmediata al remitente.

CONFIDENTIALITY NOTE: This message and any accompanying attachments contain information from sending company which is confidential or privileged and for the exclusive use of the individual or entity named above. If you received this message in error be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please inform us immediately of the erroneous delivery by returning this e-mail to the sender.

Reply all
Reply to author
Forward
0 new messages