Computing.Net > Forums > Disk Operating System > Need help with .bat file!

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.

Need help with .bat file!

Reply to Message Icon

Name: ducklips
Date: April 29, 2004 at 10:58:34 Pacific
OS: dos
CPU/Ram: latitude c540/640
Comment:

Does anyone knoe of a good net tutorial on how to write a good .bat file? I have a tricky challenge to accomplish. I suppose what I am looking for is a list of commands, hopefully a rather in-depth one.

Usually google will transform my pc into the "bat-computer" and help me find just about anything, but in this case I need the help of some experts. From what I have learned, this is the place to find some good saavy people.

Any help would be much appreciated. Thanks!

-Ducklips

"i woke up this morning and all of my stuff was stolen and replaced with exact duplicates."



Sponsored Link
Ads by Google

Response Number 1
Name: jboy
Date: April 29, 2004 at 11:40:31 Pacific
Reply:

Here's Secret_Doom's site - plenty of ready made examples.

Something more basic

A gajillion hits on Google

If you could be more specific, someone may be able to advise.


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk.


0

Response Number 2
Name: ducklips
Date: April 29, 2004 at 12:54:35 Pacific
Reply:

Thanks Jboy! Your search did bring up many more results. I was typing in ".bat" instead of "batch".

Basically, I'm trying to figure out how to get a batch file to do a "run as" action, then enter an administrator user name and password to start a program when a restricted user logs on. The app that I want to start can only be started by an administrator but i don't want the restricted user to have admin priv's.

Does that make sense? Thanks again for the above info, I have learned a lot more.

"i woke up this morning and all of my stuff was stolen and replaced with exact duplicates."


0

Response Number 3
Name: Nigel Spike
Date: April 29, 2004 at 13:32:11 Pacific
Reply:

Administrator, restricted user, admin priv's, what version of DOS are you talking about?

Nigel


0

Response Number 4
Name: ducklips
Date: April 29, 2004 at 13:51:24 Pacific
Reply:

Hi Nigel,

It is an XP workstation but I found no help in the xp forum. I'm using whatever version of DOS that is on XP Pro. I am also using Windows 2003 Server, the user will be logging onto a domain on that server. I am not up to anything negative, I just need to initiate a scanning program that needs to always be running, and I'm not about to give administrative privileges to anyone that does not need it, which is why I'm trying to get this to work.

I just found this vb code below that I might be able to call into my batch file:

'RunAs Helper
'Syntax: runas.vbs <username> <password> <command>
'
set args=wscript.arguments
username = args(0)
pass = args(1)

'Get the command arguments
for i=2 to args.count - 1
command = command & args.item(i) & " "
Next

'Used for testing
'wscript.echo "runas.exe /user:" & username & " """ & command & """"
set shell=wscript.createobject("Wscript.shell")

'Run runas.exe
shell.run "runas.exe /user:" & username & " """ & command & """"

'Wait for runas.exe to load, this time could be shorter, but is set to 1000
to be safe
wscript.sleep(1000)

'Send the password and hit enter
shell.sendkeys pass & "{ENTER}"

'end of script

Do you think this will work?

"i woke up this morning and all of my stuff was stolen and replaced with exact duplicates."


0

Response Number 5
Name: Nigel Spike
Date: April 29, 2004 at 14:05:48 Pacific
Reply:

Sorry, way over my knowledge (and really not DOS), so I can't tell if it would work. Hopefully someone comes along who can tell.
Risk is they will send you right back to the XP forum.

Anyway, good luck
Nigel



0

Related Posts

See More



Response Number 6
Name: flimflam
Date: April 29, 2004 at 14:25:13 Pacific
Reply:

JW has asked that NT Batch questions are not asked in an inappropiate forum.

You can not use the MSDOS in XP as it does not have any, will never have any and I would be pleased if everybody got this into their skulls. XP is based on IBM OS/2, NT3, NT4, W2K and therefore a 32bit O/S with an intergrated GUI, totally unlike MSDOS

Even Linux in command line looks similar to MSDOS, but it is Linix, please will all you NT users please read and digest the following article as it explains why NT is not MSDOS and MSDOS is an emulation:

http://www.computing.net/windowsxp/wwwboard/forum/103161.html


0

Response Number 7
Name: jboy
Date: April 29, 2004 at 14:43:20 Pacific
Reply:

Yeah - it's a source of confusion to many computer users. The command prompt in XP is basically the NT command interpreter - on the surface, very similar to 'classic' DOS, but the nuts & bolts are very different.

It's become something of a bone of contention in this forum, as the majority of the posts seem to be in regard to XP/2K 'DOS' - which is one reason why it's helpful to put the correct specs in the OS field when posting.

Some of that is addressed at Secret_Doom's page, but for complex batch files you need to use the specific features for your particular Operating System.

XP command Reference


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk.


0

Response Number 8
Name: Wengier
Date: April 29, 2004 at 14:48:14 Pacific
Reply:

You can also ask NT Batch questions in Programming Forum besides the NT/2K/XP Forum (or even the OS/2 Forum), but NEVER in the DOS Forum!

OS/2 was originally a joint project between MS and IBM. After their collaboration fell apart, WinNT was renamed from MS's version of OS/2 by MS (while IBM's version of OS/2 was later renamed to OS/2 Warp by IBM); Win2K and WinXP are WinNT 5.0 and WinNT 5.1 respectively. Please read here for more information about Windows NT:

http://www.sciencedaily.com/encyclopedia/microsoft_windows_nt

---------------
Long Live DOS!


0

Response Number 9
Name: ducklips
Date: April 29, 2004 at 15:08:57 Pacific
Reply:

Thanks for the help and your patience with my learning curve. I belong mainly in 3D animation and web design but I have been working more and more with workstations and networking which forced me to build and maintain a network environment.

this is a link to a 3D contest that I'm in for fun and I'll post my latest web work below that.

http://www.cgtalk.com/showthread.php?s=2169c6d44bcbf5ff7c7dc21dfc0cc430&postid=1225214#post1225214

www.recordexpressllc.com (my last site)

I'll aim to get help in the other forums but thanks again for your guidance and patience in this one.

By the way Flimflam, feel free to visit www.prozac.com

Once i get this figured out I'll post the solution here again in case you guys ever run into something like this.

take care-

-Ducklips

"i woke up this morning and all of my stuff was stolen and replaced with exact duplicates."


0

Response Number 10
Name: jboy
Date: April 29, 2004 at 15:40:01 Pacific
Reply:

That's some interesting work - I was a big fan of Heavy Metal mag and the various Undergrounds from the 70's & 80's.

Sure, look around the other forums a give your question a try there - I'm not too surprised there wasn't much help in the actual XP forum - I get the impression that most of the helpers there aren't much more knowledgeable than most of the questioners (but what do I know?)

Good luck

The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk.


0

Response Number 11
Name: flimflam
Date: April 30, 2004 at 02:32:13 Pacific
Reply:

thankyou ducklips and look forward to you posting back in the appropiate forum in the future.

btw, I do not like Prozac prefer Fluoxetine myself............


0

Response Number 12
Name: uli_glueck
Date: May 2, 2004 at 23:02:59 Pacific
Reply:

Hi all,

it is true, to get the information you want for Batches,in the NT Forum is like gambling. It seems the most know how is in the DOS Forum.

A stupid question from me:
I know the NT Konsole is different than the Dos Konsole, but most batch scripts are also working with NT.
So where is the problem to give people help if they donīt get it in Windows or Programmers Forum?

greetings
uli


0

Response Number 13
Name: jboy
Date: May 2, 2004 at 23:34:04 Pacific
Reply:

uli - I think you misunderstand. It's not like we're witholding help.

Generally speaking, the contributers here in the 'old' DOS forum are familiar with DOS, not NT. If someone can help, they will - but it seems a little unfair to expect folks to give advice or instructions concerning Operating Systems that they have little or no experience with.

It's also a matter of policy to separate the various forums (mainly) by Operating System - this simplifies the use of the 'site search' feature.


We don't post DOS questions over in the NT forum, now do we?

; )

The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk.


0

Response Number 14
Name: Wengier
Date: May 3, 2004 at 12:50:44 Pacific
Reply:

Besides what jboy had said in the above response --

a quotation from uli's post:

"most batch scripts are also working with NT"

Not true. The fact is: A lot of advanced DOS batch scripts will NOT work with NT, while most NT batch scripts will NOT work with DOS. In particular, NT batch scripts are generally incompatible with DOS systems. Read this page for more information:

http://www.batch.hpg.ig.com.br/

---------------
Long Live DOS!


0

Response Number 15
Name: Mikekirgan
Date: May 10, 2004 at 08:54:52 Pacific
Reply:

Ducklips...have you found a solution to your problem?...I have the same problem so let me know if you come up with anything!

Thanks


0

Sponsored Link
Ads by Google
Reply to Message Icon

execute multiple programs... my soundcard



Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Need help with .bat file!

Need help with Bat File www.computing.net/answers/dos/need-help-with-bat-file/12993.html

Help with Bat file www.computing.net/answers/dos/help-with-bat-file/13551.html

Need help with a Dos batch file www.computing.net/answers/dos/need-help-with-a-dos-batch-file/13006.html