1.

Solve : Help with batch file please !!!?

Answer»

Hi everyone I have had a read on these forums (and loads others!)
And I cannot see where I am going wrong?

So I am asking for your help to see if anyone here know what I should look into next?
Here is my code so far ......

@echo off
GOTO MAIN

:MAIN
CLS
COLOR 07
SET /P GAMENAME= [STRING]

IF EXIST "C:\Documents and Settings\tester\Desktop\RandomFolder\%GAMENAME%*" GOTO ENCRYPT
GOTO FILE ERROR

:ENCRYPT
ECHO FOUND FILE!
COLOR 06
attrib -r "C:\Documents and Settings\tester\Desktop\RandomFolder\%GAMENAME%_main.swf"

echo Read only attribute removed for %GAMENAME%_main.swf

CD "C:\Program Files\SWFEncrypt 4.0\swfencrypt" -overwrite "C:\Documents and Settings\tester\Desktop\RandomFolder\%GAMENAME%_main.swf"
PAUSE
GOTO END


:FILE ERROR
ECHO COULD NOT FIND FILE !
GOTO END

:END

Can anyone here see any reason this would work please I feel like I have tried everything and am now just STARING at my screen

Thanks !Well does it work or not ?

if not, what is it supposed to do and how does that differ from the actual behaviour ?Hi thanks for posting
It is supposed to start a program which encrypts swf files
(by using the -overwrite command)

However I get an error which states:
The filename, Directory name or volume label syntax is incorrect

When i try the same program with the files in the same place (but not using the batch file)
it works fine?

I just wandered if anyone noticed anything which could be wrong with this code?

Thanks again! Code: [Select]C:>cd c:\windows\notepad.exe test.txt
The system cannot find the PATH specified.

got it?Ok
so if the code has the correct path name what do I need to add to my batch file to make it recognise the pathname?

Sorry for being SLOW just that i am new to this style of coding, but thanks ALOT for your help !!Quote from: cmd_noob on March 18, 2009, 09:06:32 AM

CD "C:\Program Files\SWFEncrypt 4.0\swfencrypt" -overwrite "C:\Documents and Settings\tester\Desktop\RandomFolder\%GAMENAME%_main.swf"

remove the "CD" from the above line so it become:
"C:\Program Files\SWFEncrypt 4.0\swfencrypt" -overwrite "C:\Documents and Settings\tester\Desktop\RandomFolder\%GAMENAME%_main.swf"

make sure %gamename%_main.swf existThanks for quick reply
just tried that and the error has now changed to
"the system could not find the path specified"

However the path was coppied from the address bar from the top of the directory?

Is there anything that can be seen as wrong from the above code?


Thanks again!remove/comment @echo off to start debugging.


change:
IF EXIST "C:\Documents and Settings\tester\Desktop\RandomFolder\%GAMENAME%*" GOTO ENCRYPT
to
IF EXIST "C:\Documents and Settings\tester\Desktop\RandomFolder\%GAMENAME%_main.swf" GOTO ENCRYPT

does this path is correct?
C:\Program Files\SWFEncrypt 4.0\swfencryptthanks for yor help,

I started taking appart line by line to see what was causing the problem.

I found out iw was this line :

cd "C:\program files\SWF Encrypt 4.0\swfencrypt" -overwrite "C:\Documents and Settings\tester\Desktop\randomFile\%gameName%_main.swf"

and have since changed it to this:

CD "C:\Program Files\SWF Encrypt 4.0
swfencrypt "C:\Documents and Settings\tester\Desktop\randomFile\%gameName%_main.swf"

this seems to encrypt the file as expected however strangly the batch file then freezes and does not continue onto the next set of instructions?

thanks to all your help
it seems to work (although not quite as planned) but i think there is something wrong with the ecryption program as it takes about 10 mins to kill the task...... OH well need to search for a more compatible piece of software

Thanks agin for all your help!!


Discussion

No Comment Found