Search found 10 matches

by myjet
10 Dec 2010 06:22
Forum: DOS Batch Forum
Topic: Send variable from user input to text
Replies: 8
Views: 7160

Re: Send variable from user input to text

There's a way to read and rewrite text files too (ie make specific line changes). I recommend using strLen found on the homepage. It was just revised, it's very efficient. Huh? :strLen SETLOCAL set str=A!%~1! set len=0 set /a n=1024 set /a n^>^>=1, len+=n if !str:~%len%!. == . set /a len-=n set /a ...
by myjet
09 Dec 2010 11:28
Forum: DOS Batch Forum
Topic: Send variable from user input to text
Replies: 8
Views: 7160

Re: Send variable from user input to text

Ok I've got it :D
> will overwrite
>> will append
Oh such a simple thing...just what to be expected of beginner
by myjet
09 Dec 2010 11:06
Forum: DOS Batch Forum
Topic: Send variable from user input to text
Replies: 8
Views: 7160

Re: Send variable from user input to text

At last! I've got something very close to what I want. The only thing bugging me now is how to overwrite the existing file. I'd be glad if anyone care to leave some hint on how to do this. Better if there is option on whether to overwrite or not. Go on copy and run the following code. You'll see wha...
by myjet
09 Dec 2010 08:15
Forum: DOS Batch Forum
Topic: Send variable from user input to text
Replies: 8
Views: 7160

Re: Send variable from user input to text

And what should be done to overwrite the existing text file, not just append the new string? For example if the text already contained "This is the question", if I run the program the text file will then contain "This is the question<satu><item soalan='%question%' jawapanA='A: "....
by myjet
09 Dec 2010 07:33
Forum: DOS Batch Forum
Topic: Send variable from user input to text
Replies: 8
Views: 7160

Re: Send variable from user input to text

One more thing:
How do I convert the following code in C, into batch script?

cin>>str1;
strlen(str1);
do{
//process;
}while(var1<=15)
by myjet
09 Dec 2010 07:07
Forum: DOS Batch Forum
Topic: Send variable from user input to text
Replies: 8
Views: 7160

Re: Send variable from user input to text

Nice! That works! Just exactly what I need. Thank you very much
by myjet
09 Dec 2010 05:25
Forum: DOS Batch Forum
Topic: Send variable from user input to text
Replies: 8
Views: 7160

Send variable from user input to text

Hello, I have a script that prompt user to input a variable and passes that variable to a text file, along with another predefined string: cls @echo off echo Enter your question set /p question= echo %question% echo "<satu><item soalan='%question%' jawapanA='A: " >> Question1.xml exit This...
by myjet
16 Aug 2010 23:05
Forum: DOS Batch Forum
Topic: Set DNS server batch program
Replies: 3
Views: 4679

Re: Set DNS server batch program

Great! Thanks aGerman. This works well for me. You were right that I can't be sure of the number of tokens should be used. Therefore this is my full code (tested to work regardless of what the wireless network connection name is): for /f "delims=:" %%a in ('ipconfig/all^|findstr /c:"W...
by myjet
16 Aug 2010 06:29
Forum: DOS Batch Forum
Topic: Set DNS server batch program
Replies: 3
Views: 4679

Re: Set DNS server batch program

I found a possible solution, though I still doubt it will work on every computer. I use: ipconfig/all>MAC.txt to dump the configurations info and then use: for /f "tokens=4-10 delims=: " %%b in ('"findstr "Wireless LAN adapter "" MAC.txt') do set ans=%%b %%c %%d %%e whe...
by myjet
11 Aug 2010 00:36
Forum: DOS Batch Forum
Topic: Set DNS server batch program
Replies: 3
Views: 4679

Set DNS server batch program

Hi, I know how to set the DNS server for a connection named "Wireless Network Connection" using netsh interface ip set dns "Wireless Network Connection" static xxx.xxx.xxx.xxx But the problem is, not every computer has its wireless connection named "Wireless Network Connecti...