473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Return any character positions within a string

I have a .bat file that has the following links with network passwords.

net use u: \\Myserver\Folder45 Cyrus024 /User:NA\cyrus.t.andrews
net use v: \\Myserver\Folder3645 Cyrus024 /User:NA\cyrus.t.andrews
net use x: \\Myserver\Folder32645 Cyrus024 /User:NA\cyrus.t.andrews
net use y: \\Myserver\Folder995 Cyrus024 /User:NA\cyrus.t.andrews

I want the code to pull the password "Cyrus24" so that it can be replaced. I want to be able to do this every 30 days when the password expires. Problem is I have to define the string exactly in order to change the characters I want to change. How can I get the code to pull any 8 characters that proceed "^/User:NA\cyrus.t.andrews"?

Here is what I have tried:

'--get text to replace and new text.
s1 = inputbox ("Enter text to be replaced.", "What to replace?", Right/User:NA\cyrus.t.andrews ",8))
Mar 21 '07 #1
1 1181
ansumansahu
149 100+
I have a .bat file that has the following links with network passwords.

net use u: \\Myserver\Folder45 Cyrus024 /User:NA\cyrus.t.andrews
net use v: \\Myserver\Folder3645 Cyrus024 /User:NA\cyrus.t.andrews
net use x: \\Myserver\Folder32645 Cyrus024 /User:NA\cyrus.t.andrews
net use y: \\Myserver\Folder995 Cyrus024 /User:NA\cyrus.t.andrews

I want the code to pull the password "Cyrus24" so that it can be replaced. I want to be able to do this every 30 days when the password expires. Problem is I have to define the string exactly in order to change the characters I want to change. How can I get the code to pull any 8 characters that proceed "^/User:NA\cyrus.t.andrews"?

Here is what I have tried:

'--get text to replace and new text.
s1 = inputbox ("Enter text to be replaced.", "What to replace?", Right/User:NA\cyrus.t.andrews ",8))
We can use the Instr function to retrive the character position.

InStr returns the first occurrence of a string inside another string.

InStr([start,] string1, string2 [, compare])

thanks
ansuman sahu
Mar 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: jen_designs | last post by:
Is there a way to return the character position on a page? Not the x and y coordinates, but the number of characters on a page. For instance i have a html page with the following text: This is my...
1
by: Colin Green | last post by:
OK here's is what I wish to do. I have an XML file that I want to read into an XmlDocument. I then want to be able to interrogate the XmlNodes to find both their start AND end character positions...
9
by: Christian Kandeler | last post by:
Hi, if I want to store the string "123456" in a variable of type char, I can do it like this: char s = "123456"; Or like this: char s = { '1', '2', '3', '4', '5', '6', '\0' };
18
by: Pedro Pinto | last post by:
Hi there once more........ Instead of showing all the code my problem is simple. I've tried to create this function: char temp(char *string){ alterString(string); return string;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.