Sign in with
Sign up | Sign in
Your question
Solved

Error in Batch File

Last response: in Windows 7
Share
July 13, 2011 10:28:06 PM

Hi Guys, :hello: 
I recently am making my own folder-lock "Software" and was all fine until the last Batch,

@echo off
title ZionBot Settings...
if EXIST ZionBot.exe goto Change
echo When notepad appears, change HEREHEREHEREHEREHERE to your desired password. Go file>save and save again...
pause
notepad"C:\Program Files\ZionBot\Zionbot.bat"
echo When dialog pops up, click "Compile" on the bottom. When finished, close the window...
pause
"C:\Program Files\ZionBot\bat2exe.exe"
echo ZionBot Installation is now complete...
del "Desktop\Create Password.lnk"
pause
goto End
:Change
echo Enter PIN giving at your purchase...
set/p "pass=>"
if NOT %pass%==Pin goto Change
echo When notepad appears, change HEREHEREHEREHEREHERE to your desired password. Go file>save and save again...
pause
notepad "C:\Program Files\ZionBot\Zionbot.bat"
Del "C:\Program Files\ZionBot\Zionbot.exe"
echo When dialog pops up, click "Compile" on the bottom. When finished, close the window...
pause
"C:\Program Files\ZionBot\bat2exe.exe"
echo ZionBot password is now changed...
pause
:End
cls

It's suppose to open notepad were the user can enter his/her desired password, he/she already made one it is changed.
I tried it out and this happened.




It skips the first few lines, HELP!! :(  :cry: 

More about : error batch file

July 14, 2011 11:20:58 AM

Turn ECHO back on and see what's happening. ECHO OFF is only for AFTER it's been debugged and working as expected to keep the output clean.
m
0
l

Best solution

July 15, 2011 6:11:24 AM

Hi newcomer. It seems you didn't read the rules for posting on these forums cause when posting code, you have to put these in-between [.code][/code] (minus the dot) to make things clear for everyone, and show that these lines are the actual code. Now that's being said, I would be a brute not to answer someone polite enough to salute us. ^^

I'll give you a trick: when testing and you don't know what happen, just insert some more echo lines in-between some principal lines. Here's a small example to show what I mean:
  1. echo Here's a program to do something...
  2. first command
  3. echo test1
  4. second command
  5. echo test2
  6. third command
  7. echo test3
  8. fourth command
  9. echo now it should have worked all the way...
  10. etc.
  11. etc.

By doing this, when executing the program you'll get a visual on what lines are skipped, ran, or did not ran the way it's intended. Once you know the program runs perfectly you can just do a little search through your program, searching for "test" and delete all these lines. That'll take seconds but will save you hours of blind debug. Oh well now let's talk about your program.

I copied your program in a batch file on my desktop, then opened a command windows before running your program. It first told me to press any key which I did, then a file named "save" appeared on my desktop.

I opened that "save" file. Here's what it's written in it:
Quote:
When notepad appears, change HEREHEREHEREHEREHERE to your desired password. Go file and save again...

that specific program line is this:
Quote:
echo When notepad appears, change HEREHEREHEREHEREHERE to your desired password. Go file>save and save again...


So your program is misinterpreting your echo line. The quotes ("") does not only serve when there are spaces in filenames, but also when there are symbols that has other functions as well. In this case the english quotes (<>) means a read/write to a file, which the program did as you can see, it did save the echo line in a file named save, as the english quotes implies in this line. Just put your line in quotes ("") when using symbols, and the line will execute normally, showing text in the command windows and not in a file named "save".
Share
Related resources
July 29, 2011 7:28:37 AM

sorry for the super late reply, thanks MrBig55 I did just that and it work like a charm, I also digged in for special characters in the interweb and found special characters can be escaped by the ^ key infront of it.
thanks dude, over 9000 internets to you
m
0
l
July 29, 2011 9:25:36 PM

Best answer selected by chippy9000.
m
0
l
!