Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Whykonen

Fixed the problem, i used

for /F "delims=" %%a in ('findstr /c:UserName WinSCP.ini') do set username=%%a
Whykonen

Username in batch script retrieval

Hello,

I'm trying to retrieve the username of a stored session, to use in the batch script.

Is there a parameter to retrieve UserName as defined in winscp.ini?

Thanks in advance!

Script:

IF EXIST "C:\Users" goto nietwinxp

IF EXIST "C:\Documents and Settings" goto winxp

:nietwinxp
echo nietwinxp
winscp.com /script=nietwinxp.txt
if errorlevel 1 goto error
goto end

:winxp
echo winxp
winscp.com /script=winxp.txt
if errorlevel 1 goto error
goto end

:error
cscript sendmail.vbs addresseddude@provider.com "subject line" "Content, username here"

:end
PAUSE
[/code]