You are not logged in.
Utilizing cmdtwain and thebat! to half-automatize documents scanning and sending in script:
@echo off
set "rcpt=user@host.com"
::
REM == If old protokol exist, delete it ========================================
if exist "c:\Users\user\Desktop\protokol.jpg" del "c:\Users\user\Desktop\protokol.jpg" >NUL 2>&1
::
REM == Scan protocol new protocol =========================================
"C:\Program Files (x86)\GssEziSoft\CmdTwain\cmdtwain.exe" -q -c 600 100 "c:\Users\user\Desktop\protokol.jpg"
::
REM == Open new mail editor window for writing and attach protocol file ==============
"C:\Program Files\The Bat!\thebat64.exe" /NOLOGO /MAILU=User;to=%rcpt%;subject=Protokol;edit;attach="c:\Users\user\Desktop\protokol.jpg"
last line of script failed and give me %SUBJ%. When have @echo on, and copy last line of script from cmd window and paste it back to original cmd window and pres ENTER, than successfully execute without any err message. Whan am I doing wrong?
Offline
Are you showing us the entire script?
I notice that there is a "!" in the last line.
If you have delayed expansion enabled that "!" will be lost.
Windows Shell Scripting and InstallShield
Offline
Those semicolons are delimiters, so CMD will treat them just like spaces unless the entire string is placed in quotes
https://ss64.com/nt/syntax-esc.html
This means you will also have to escape or double up the quotes in the final pathname, although as it does not include any spaces you could just leave those quotes out.
Offline
Are you showing us the entire script?
I notice that there is a "!" in the last line.
If you have delayed expansion enabled that "!" will be lost.
Whole code is displayed, delayed expansion not employed.
Offline
Those semicolons are delimiters, so CMD will treat them just like spaces unless the entire string is placed in quotes
https://ss64.com/nt/syntax-esc.htmlThis means you will also have to escape or double up the quotes in the final pathname, although as it does not include any spaces you could just leave those quotes out.
You are right, this variant work fine:
"C:\Program Files\The Bat!\thebat64.exe" /NOLOGO /MAIL"U=User;to=%rcpt%;subject=Protokol;edit;attach="c:\Users\user\Desktop\protokol.jpg^""
thanks
Last edited by lazna (01 Nov 2020 11:01)
Offline
Simon Sheppard wrote:Those semicolons are delimiters, so CMD will treat them just like spaces unless the entire string is placed in quotes
https://ss64.com/nt/syntax-esc.htmlThis means you will also have to escape or double up the quotes in the final pathname, although as it does not include any spaces you could just leave those quotes out.
You are right, this variant work fine:
"C:\Program Files\The Bat!\thebat64.exe" /NOLOGO /MAIL"U=User;to=%rcpt%;subject=Protokol;edit;attach="c:\Users\user\Desktop\protokol.jpg^""
thanks
With that variant only the parts in bold are being quoted
"C:\Program Files\The Bat!\thebat64.exe" /NOLOGO /MAIL"U=User;to=%rcpt%;subject=Protokol;edit;attach="c:\Users\user\Desktop\protokol.jpg^""
for a path with spaces, you probably need:
"C:\Program Files\The Bat!\thebat64.exe" /NOLOGO /MAIL"U=User;to=%rcpt%;subject=Protokol;edit;attach=""c:\Users\user\this can have spaces\protokol.jpg"" "
Offline