Computing.Net > Forums > Programming > simple batch program

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

simple batch program

Reply to Message Icon

Name: davidcane
Date: February 6, 2005 at 23:48:14 Pacific
OS: WindowsXP Pro
CPU/Ram: Intel Centrino 1.5Ghz & 5
Comment:

Hi,

I was just interested in a post made last year - a simple batch program:

@Echo Off
ClS
Echo Hey, my name is Mike.
Pause
CD C:\MyVideo
:LOOP
Set /P Video=Enter the Video you like^>
If /I %Video%.==EXIT. GoTo :EOF
If exist %Video% GoTo :PLAY
Echo Sorry... Video not found, try again
Echo Type EXIT to quit
GoTo :LOOP

:PLAY
Echo Enjoy the video!
Pause
Start MPlayer2 "%video%.mpg"


I was wondering if a have a list of videos saved in another batch file:
video1.mpg
video2.mpg
video3.mpg

How can I play the list I've made using the above batch program.

Thanks,
David




Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: February 7, 2005 at 00:39:21 Pacific
Reply:

dir /s/b c:\somepath\*.mpg>my.m3u
start mplayer2 my.m3u

M2


0

Response Number 2
Name: davidcane
Date: February 7, 2005 at 17:12:08 Pacific
Reply:

Thanks.

But what if the list (batch file) already contains the specific location of each file:
c:\dir1\vid1.mpg
c:\dir2\vid2.mpg
d:\dir3\vid3.mpg
e:\dir4\vid4.mpg
& so on up to 50 or more directory locations

Will I be able to use some sort of type command to execute a per line item for all my videos?

Thanks,
David


0

Response Number 3
Name: Mechanix2Go
Date: February 7, 2005 at 19:55:25 Pacific
Reply:

Hi David,

::== playlist builder
@echo off
echo c:\dir1\vid1.mpg >> some.m3u
echo c:\dir2\vid2.mpg >> some.m3u
echo d:\dir3\vid3.mpg >> some.m3u
echo e:\dir4\vid4.mpg >> some.m3u
::== and so on


M2


0

Response Number 4
Name: davidcane
Date: February 7, 2005 at 22:36:29 Pacific
Reply:

Thanks,thanks!

Last favor.

I managed to organized the names of the user in the network using the command "net user > list.txt". By removing the unnecessary data the list looked like this:
Administrator
guest
user1
user2
user3
user4

How can i use the LSMOD command in the batch program below without having to type every user in the list.txt (it's tiresome to search & type in more than 200 users).


@Echo Off
ClS
Echo Batch Script
Pause
:LOOP
Set /P user=Enter the user name^>
If /I %user%.==exit. GoTo :EOF
If exist %user% GoTo :EXECUTE

:EXECUTE
Echo User save to text!
Pause
net user "%user%" > "%user%".txt
GoTo :LOOP


Thanks,
David


0

Response Number 5
Name: Mechanix2Go
Date: February 7, 2005 at 23:38:00 Pacific
Reply:

Hi David,

Now I'm lost.

What is LSMOD?

And are we trying to tailor a playlist according to user?

M2


0

Related Posts

See More



Response Number 6
Name: davidcane
Date: February 8, 2005 at 00:48:28 Pacific
Reply:

Oops, sorry 'bout that. The dos program was LMOD.COM (line modification or list modification) - a dos filter (STDIN/STDOUT).

The video batch program did great. This one is another batch program (with a little similarity with the video batch program).

The netuser batch program focuses on capturing the details of each user by using the command c:\net user "username" and saving the contents in a text file
c:\net user "username" > "username".txt

I'm finding a way to automatically get the name of each user in a generated list (assuming I've a list of username in a text file)to the netuser batch program without having them typed in the batch program one by one.

I did found a program called LMOD.COM that might be capable of extracting the line by line item of the user listing that I have but I'm having difficulty in integrating it with the netuser batch program.

I was wondering if an outside program like LMOD necessary or the built in command in DOS sufficient.

Thanks a lot for the help.

-David


0

Response Number 7
Name: Mechanix2Go
Date: February 8, 2005 at 01:33:04 Pacific
Reply:

Hi David,

I'm fuzzy, but I'm getting there.

So you have LMOD, which is a 3rd party utility, right?

I have something similar; a tiny COM util from PCMag.

As to whether it can be done using only standard XP, depends on the changes needed.

So, keeping it simple, you have a text file with:

guest
user1
user2

What does the desired file look like when it's finished?

M2


0

Response Number 8
Name: davidcane
Date: February 8, 2005 at 01:59:44 Pacific
Reply:

Yup. The LMOD is a third party utility.

Basically the batch program will just do:
c:\net user guest > guest.txt
c:\net user user1 > user1.txt
c:\net user user2 > user2.txt

And the sample output (contents of the guest.txt):

User name Guest
Full Name
Comment Built-in account for guest access to the computer/domain
User's comment
Country code 000 (System Default)
Account active No
Account expires Never

Password last set 2/8/2005 5:41 PM
Password expires Never
Password changeable 2/8/2005 5:41 PM
Password required No
User may change password No

Workstations allowed All
Logon script
User profile
Home directory
Last logon Never

Logon hours allowed All

Local Group Memberships *Guests
Global Group memberships *None
The command completed successfully.


I'm doing a batch program that have the command: net user "username" > "username".txt

The source of the "username" comes from a list.txt which have:
Administrator
Guest
User1
User2
User3
and so on.

The output will depend on the number of users on the network. For my example above, I will have the following files as output:
Administrator.txt
Guest.txt
User1.txt
User2.txt
User3.txt
and so on.

Hope this helps.

Thanks,
David


0

Response Number 9
Name: Mechanix2Go
Date: February 8, 2005 at 02:44:57 Pacific
Reply:

Hi David,

This should do it:

::==
@echo off
for /f "tokens=*" %%U in (userlist.txt) do call :userDAT %%U

goto :eof

:userDAT

net user %1 > %1.txt

:eof
::==

Note that the 2nd line starts with "for" and ends with "%%U" [no quotes] but may get wrapped by this forum interface.

M2


0

Response Number 10
Name: davidcane
Date: February 8, 2005 at 17:13:33 Pacific
Reply:

Wow, thanks!

-David


0

Response Number 11
Name: Mechanix2Go
Date: February 9, 2005 at 21:04:50 Pacific
Reply:

David,

You owe me two beers.

M2


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: simple batch program

Help with simple batch scripting www.computing.net/answers/programming/help-with-simple-batch-scripting/15226.html

simple batch file prog q.. www.computing.net/answers/programming/simple-batch-file-prog-q/14278.html

Batch programming www.computing.net/answers/programming/batch-programming/15528.html