[RESOLVED] [ERROR] Batch Script - Path Problem

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
RedEyedRocker
Posts: 19
Joined: 25 Mar 2017 12:15
Location: Nepal
Contact:

[RESOLVED] [ERROR] Batch Script - Path Problem

#1 Post by RedEyedRocker » 25 Mar 2017 12:31

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
Last edited by RedEyedRocker on 25 Mar 2017 22:40, edited 3 times in total.

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: [ERROR] Batch Script - Path Problem

#2 Post by penpen » 25 Mar 2017 13:43

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

RedEyedRocker
Posts: 19
Joined: 25 Mar 2017 12:15
Location: Nepal
Contact:

Re: [ERROR] Batch Script - Path Problem

#3 Post by RedEyedRocker » 25 Mar 2017 14:32

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.

RedEyedRocker
Posts: 19
Joined: 25 Mar 2017 12:15
Location: Nepal
Contact:

Re: [ERROR] Batch Script - Path Problem

#4 Post by RedEyedRocker » 25 Mar 2017 14:37

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!!!

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: [ERROR] Batch Script - Path Problem

#5 Post by aGerman » 25 Mar 2017 15:03

Please see
viewtopic.php?f=3&t=7729

Steffen

Post Reply