Search found 187 matches

by Fawers
20 May 2012 21:16
Forum: DOS Batch Forum
Topic: parsing the %CD% variable
Replies: 11
Views: 8691

Re: parsing the %CD% variable

This "version" of the FOR loop (without any extra option like /L, /F) will output text separately; in this case, the default delimiter are blank spaces. For instance, if you write the code like this: for %%n in (My name is john) do echo %%n it will output 4 different strings: My name is jo...
by Fawers
20 May 2012 19:49
Forum: DOS Batch Forum
Topic: parsing the %CD% variable
Replies: 11
Views: 8691

Re: parsing the %CD% variable

aGerman wrote:Try

Code: Select all

for %%i in ("%cd:\=" "%") do if %%i neq "" echo %%~i

Regards
aGerman


Damn, aGerman. That was genius! I would never had thought of that.
As said before, brilliant.
by Fawers
16 May 2012 22:22
Forum: DOS Batch Forum
Topic: How do you Exit from all child and parent batch processes?
Replies: 8
Views: 8980

Re: How do you Exit from all child and parent batch processe

"Dude", I gave you 2 answers. The first time I told you to remove /b from exit. You said you didn't want cmd to close as well. I said to run the code with cmd /c. Still it seems that you don't want to accept it. "I don't want to execute a.bat any differently than I execute my other ba...
by Fawers
16 May 2012 22:09
Forum: DOS Batch Forum
Topic: How do you Exit from all child and parent batch processes?
Replies: 8
Views: 8980

Re: Re:How do you Exit from all child and parent batch proce

taripo wrote:No I don't want to execute a.bat any differently than I execute my other bat files. Just a.bat
C:\whatever>a <ENTER>

Then the only thing you can do is remove "echo def". As far as I understand, you don't need it at all if you want to ommit it.
by Fawers
16 May 2012 21:47
Forum: DOS Batch Forum
Topic: How do you Exit from all child and parent batch processes?
Replies: 8
Views: 8980

Re: How do you Exit from all child and parent batch processe

Then try leaving exit without the /b switch and running your batch from a child itself.

Code: Select all

cmd /c a.bat
by Fawers
16 May 2012 21:25
Forum: DOS Batch Forum
Topic: Setting the ping address with Variable?
Replies: 13
Views: 8692

Re: Setting the ping address with Variable?

As to your code for grabbing the IP, did you try it? It didn't quite work for me and I doubt it could've worked for you, as it was. Yes, I did. It works pretty well. It has to be tokens=1-3 not tokens=1-2. No, it doen't. We need the text between [brackets] - the 2nd token. We don't need anything af...
by Fawers
16 May 2012 20:34
Forum: DOS Batch Forum
Topic: Why does | to a non-existent command, cause an Exit?
Replies: 6
Views: 4498

Re: Why does | to a non-existent command Exit?

Try adding a pause to this code.

Edit:
Strange. I actually tried it. Pause has no effect.

But anyway, why would you want to pipe a command to a "random string"?
by Fawers
16 May 2012 17:42
Forum: DOS Batch Forum
Topic: Setting the ping address with Variable?
Replies: 13
Views: 8692

Re: Setting the ping address with Variable?

You made me curious. What exactly is "FrostedFlakes"?
by Fawers
16 May 2012 17:32
Forum: DOS Batch Forum
Topic: Setting the ping address with Variable?
Replies: 13
Views: 8692

Re: Setting the ping address with Variable?

Still not working... would you mind posting the working code? Also, here is the screencapture... http://farm6.staticflickr.com/5341/7212084944_857a544326.jpg There's no IP address on your image. My code works when there's and actual IP address in the output. Here's what I get: C:\Documents and Sett...
by Fawers
16 May 2012 10:43
Forum: DOS Batch Forum
Topic: RC4 Encryption / Decryption Command line Tool
Replies: 7
Views: 7101

Re: RC4 Encryption / Decryption Command line Tool

' Hi jitc, Fawers, My memory is hazy but my guess is I tested Cleptography's code successfully from within an isolated Virtual Machine, yet decided not to keep the code. I didn't trust this person anymore after he showed me his interest in security flaws and backdoors. Someone I trust like for exam...
by Fawers
15 May 2012 22:02
Forum: DOS Batch Forum
Topic: Setting the ping address with Variable?
Replies: 13
Views: 8692

Re: Setting the ping address with Variable?

It didn't work... are you saying i should just put that whole thing under YES or am i missing something? (I'm sorry, the code you posted just makes no sense to my newbie mind...) Well, %address% should be a website address and not the ip itself (since you actually want the ip). On my command line, ...
by Fawers
15 May 2012 21:14
Forum: DOS Batch Forum
Topic: Setting the ping address with Variable?
Replies: 13
Views: 8692

Re: Setting the ping address with Variable?

Try this:

Code: Select all

for /f "tokens=1,2 delims=[]" %%h in ('ping -n 1 %address%') do (
  if not [%%i] == [] set "IP=%%i"
)
by Fawers
15 May 2012 16:59
Forum: DOS Batch Forum
Topic: RC4 Encryption / Decryption Command line Tool
Replies: 7
Views: 7101

Re: RC4 Encryption / Decryption Command line Tool

Just like jitc, I'm cruious about this encrypting/decrypting program.

I too wonder if it's still available (even though string encryption can be easily done from and to base64 using Python).
by Fawers
14 May 2012 14:41
Forum: DOS Batch Forum
Topic: ErrorLevel Command Required?
Replies: 26
Views: 15229

Re: ErrorLevel Command Required?

A simple way to set errorlevel to any integer is using cmd /c exit n, where n is the desired number.

I just tried directly on my command line to set it to 4 - and it worked.
You just have to put this piece of code where you need ERRORLEVEL to be changed at.