Hello everyone.
This is my first visit to the site and i'm not very advanced with batch files, so i'm sure i'll need all the help i can get.
What i'm trying to do is open a path to a file stored in Application Data (or AppData for vista) where flash cookies are stored. This file resides in %APPDATA%\Macromedia\Flash Player\#SharedObjects\<random string>\www.example.com\eg.sol
I want this batch file to work on most windows computers so i need a way to get past the <random string>, containing characters and numbers, and open the "eg.sol" file.
Is there a way this can be done, or is there a way to retrieve this random string automatically and load it automatically into the path to the file?
Many thanks,
Jason
Open file when full path is unknown. (Flash Cookies)
Moderator: DosItHelp
Re: Open file when full path is unknown. (Flash Cookies)
Hi JasonC.
So far. But which app do you wanna open this *.sol file?
Regards
aGerman
Code: Select all
@echo off &setlocal
set "root=%APPDATA%\Macromedia\Flash Player\#SharedObjects"
set "folder=www.example.com"
set "file=eg.sol"
pushd "%root%"
for /f "delims=" %%a in ('dir /ad /b /s^|findstr /l /i /e /c:"\%folder%"') do set "xPath=%%a"
popd
if not defined xPath (
echo Folder not found
pause
goto :eof
)
dir /b "%xPath%\%file%" >nul || (
pause
goto :eof
)
echo Entire path:
echo "%xPath%\%file%"
pause
So far. But which app do you wanna open this *.sol file?
Regards
aGerman
Re: Open file when full path is unknown. (Flash Cookies)
Thanks aGerman.
I do not actually want to open the .sol file but instead upload it to an FTP server in an all-in-one batch script.
I looked around the net for a while and found a script that does manage to automate ftp uploads in one batch file but when i tried using the 'put' command with an alias such as '%APPDATA%' it would just say that the directory was not found.
EDIT: I actually found this script at this site here http://www.dostips.com/DtTipsFtpBatchScript.php under the section 'FTP - Simple Single Batch - FTP script and batch in a single file'
Is there any way you could adapt this code to work with the solution you made earlier?
Thanks again.
I do not actually want to open the .sol file but instead upload it to an FTP server in an all-in-one batch script.
I looked around the net for a while and found a script that does manage to automate ftp uploads in one batch file but when i tried using the 'put' command with an alias such as '%APPDATA%' it would just say that the directory was not found.
EDIT: I actually found this script at this site here http://www.dostips.com/DtTipsFtpBatchScript.php under the section 'FTP - Simple Single Batch - FTP script and batch in a single file'
The "FTP -s:ftpscript.txt" option executes a FTP script wheres "%~f0" resolved to the name of the running batch file. "GOTO:EOF" ends the batch script and makes sure the FTP script doesn`t run as part of the batch.
Good: You end up with only one file that contains the batch script and the FTP script combined.
Minor flaw: The batch command in the first line causes an "Invalid command." error when executed in FTP context, however the FTP execution will continue.Code: Select all
@ftp -i -s:"%~f0"&GOTO:EOF
open example.com
username
password
!:--- FTP commands below here ---
lcd c:\MyLocalDirectory
cd public_html/MyRemoteDirectory
binary
mput "*.*"
disconnect
bye
Is there any way you could adapt this code to work with the solution you made earlier?
Thanks again.
Re: Open file when full path is unknown. (Flash Cookies)
Hi JasonC.
I don't know much about ftp and I can't test it. But the principle will be clear to me.
IMHO you should write a temporary ftp-script by batch. Probably as following.
Of course you have to personalize it.
Regards
aGerman
I don't know much about ftp and I can't test it. But the principle will be clear to me.
IMHO you should write a temporary ftp-script by batch. Probably as following.
Code: Select all
@echo off &setlocal
set "root=%APPDATA%\Macromedia\Flash Player\#SharedObjects"
set "folder=www.example.com"
set "file=eg.sol"
set "ftpscript=%temp%\tmp.ftp"
pushd "%root%"
for /f "delims=" %%a in ('dir /ad /b /s^|findstr /l /i /e /c:"\%folder%"') do set "xPath=%%a"
popd
if not defined xPath (
echo Folder not found
pause
goto :eof
)
dir /b "%xPath%\%file%" >nul || (
pause
goto :eof
)
REM write the ftp-script
(
echo open example.com
echo username
echo password
echo lcd "%xPath%"
echo cd public_html/MyRemoteDirectory
echo binary
echo put "%file%"
echo disconnect
echo bye
)>"%ftpscript%"
REM call the ftp-script
ftp -i -s:"%ftpscript%"
REM delete the ftp-script
del "%ftpscript%"
pause
Of course you have to personalize it.
Regards
aGerman
Re: Open file when full path is unknown. (Flash Cookies)
Thanks again for all your amazing help.
I will test it later this evening and report back here. Luckily i have used ftp before so i can easily manage to change some of the variables.
I will test it later this evening and report back here. Luckily i have used ftp before so i can easily manage to change some of the variables.