Page 1 of 1

[RESOLVED] [ERROR] Batch Script - Path Problem

Posted: 25 Mar 2017 12:31
by RedEyedRocker
EDIT 2: So the fix I mentioned in EDIT caused another problem resulting in Quotes to appear so the fix was to prepend "^"
to every special characters to escape sequence which included these:
% - %%
( - ^(
) - ^)
> - ^>
>> - ^>^>
^ - ^^

As I failed to prepend every special characters of these kinds in my code, I thought that was not the solution but it was my own fault. I had to prepend every special characters as I mentioned above.
Thanks to penpen and aGerman


EDIT: I JUST FIXED MY OWN PROBLEM MYSELF!!! FIX = echo "<text>" >> "<destination\<filename>>"
So, for example, If I want to write something into a file like say '(set CHAR[f]=ERG54S)' then I can't simply just do this:
echo (set CHAR[f]=ERG54S) > text.txt
I will need to add the double quotes as well " " like this:
echo "(set CHAR[f]=ERG54S)" > text.txt

Hello Beautiful People on the Internet!
I'm RedEyedRocker.
I'm trying to create a software and this part gives error. So basically, I'm trying to add the following line into a "Encrypt.bat" file.

All of those directories already exist, no spelling errors or anything.

ERROR:-

Code: Select all

(set CHAR[a]=UDFM45
(set CHAR[f]=ERG54S)
(set CHAR[k]=VCBC3B)
(set CHAR[p]=TH5DF5)
(set CHAR[u]=BCX6DF)
(set CHAR[z]=45T1FG)
(set CHAR[5]=F6DFG1)
(set CHAR[0]=87H8G7)
(set CHAR[(]=45F465)
(set CHAR[\]=45GH45)
set char=~0,1userprofile\Documents\TheRivalsRage\Encrypt-Decrypt\functions\Encrypt.bat
set userInput=~1userprofile\Documents\TheRivalsRage\Encrypt-Decrypt\functions\Encrypt.bat
The system cannot find the path specified.


If you want the part of my full code for "Encrypt.bat" file then here: http://pastebin.com/wPHA0vBG

Re: [ERROR] Batch Script - Path Problem

Posted: 25 Mar 2017 13:43
by penpen
Actually i have not much time, but it seems (although it is guessed), that you made two errors:
- You (probably) have echo some poisonous characters like '(', ')', '&', '|', ... without using their escape sequence (prepend an '^' character).
- You may also have done string operation on an undefined (/empty) environment variable; always add a character in front to make sure it is not empty.


penpen

Re: [ERROR] Batch Script - Path Problem

Posted: 25 Mar 2017 14:32
by RedEyedRocker
penpen wrote:Actually i have not much time, but it seems (although it is guessed), that you made two errors:
- You (probably) have echo some poisonous characters like '(', ')', '&', '|', ... without using their escape sequence (prepend an '^' character).
- You may also have done string operation on an undefined (/empty) environment variable; always add a character in front to make sure it is not empty.


penpen


>> I already tried prepending '^' and when I do that, the program won't even run, it just exits.
As I said, this is just a part of my whole program, I have already set the string on a defined variable, it's not empty at all.
Ok so what I want is, when I start my batch file, I want my batch file to create another batch file which contains another program I need to call it later from my 1st one. That's what I want, everything I want creates on that other batch file except the part of the code I shared.

Re: [ERROR] Batch Script - Path Problem

Posted: 25 Mar 2017 14:37
by RedEyedRocker
penpen wrote:Actually i have not much time, but it seems (although it is guessed), that you made two errors:
- You (probably) have echo some poisonous characters like '(', ')', '&', '|', ... without using their escape sequence (prepend an '^' character).
- You may also have done string operation on an undefined (/empty) environment variable; always add a character in front to make sure it is not empty.


penpen


>> HOLY SHIT! I JUST FIXED MY OWN PROBLEM MYSELF!!!

Re: [ERROR] Batch Script - Path Problem

Posted: 25 Mar 2017 15:03
by aGerman
Please see
viewtopic.php?f=3&t=7729

Steffen