Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Batch File Program

Posted on 2011-03-25
9
509 Views
Last Modified: 2012-05-11
I want to Write a  batch file to change a few settings in group policy, if it is possbile then please let me know the basic program to write a bath file?
0
Comment
Question by:venkatspb
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 2

Accepted Solution

by:
thomas_nilsson earned 125 total points
ID: 35213633
To write a batch file you can use any texteditor. A batch file is just a textfile with file extension ".bat", so Notepad would do if you remember to save it with the correct extension. Or rename the file afterwards.

But maybe that was not your question?
0
 
LVL 20

Assisted Solution

by:clarkscott
clarkscott earned 125 total points
ID: 35213698
Your batch file would look like commands you would type in the COMMAND PROMPT, such as

CD C:\YourFolder
Rename YourFile.txt "Your File.txt"
RunProgram.exe
Exit

Notice the quotes around "Your File.txt".  This is necessary if you have spaces in file titles.
The EXIT at the end closes the command prompt session.

You can use notepad for the editor.  Save or rename to .bat when finished.
You can create a Windows Shortcut to this file if you like.

Scott C


0
 
LVL 2

Assisted Solution

by:edzhu
edzhu earned 125 total points
ID: 35214813
I don't think using batch file is a good idea to modify the group policy. I recommend you to use the vbscript to do so. If you want to repeat change some value, you can write a small vbscript for one item and then write a batch file to call this vbscript repeatedly.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 3

Author Comment

by:venkatspb
ID: 35220892
Dear edzhu,

Thanks very much for your suggestion. I want to disable the usb and wireless devices in the laptop. Is is possible to write a script for that? If so please suggest me the code. Thanks.

Thanks,
Venkat
0
 
LVL 2

Expert Comment

by:edzhu
ID: 35221083
Venkat,

For the detail problem, I think the following two articles will be helpful to you. It provides you a solution to disable the usb device.
http://support.microsoft.com/kb/555324
http://badzmanaois.blogspot.com/2008/09/disable-usb-storage-using-vbs-script_07.html
I am not sure about the wireless. But I think it is same.
0
 
LVL 3

Author Comment

by:venkatspb
ID: 35229121
Dear edzhu,

Could u pls write a VBscript for changing the group policy state from not configuring to disable.

for eg: (in windows 7)

run->gpedit.msc->Computer configuration->Adminstrative templates-> windows components->Remote Desktop Services->Remote Desktop Session Host-> Connection->Allow user to connect remotely using Remote Desktop Services..... -> want to make not configured to enable),

and also in same prog want to change

 run->gpedit.msc->Computer configuration->Adminstrative templates-> windows components->Remote Desktop Services->Remote Desktop Session Host-> Security->Allow user to connect remotely using Remote Desktop Services..... -> want to make not configured to enable)

and

run-> gpupdate /force.

Adv many thnks

regards
Venkat


0
 
LVL 10

Assisted Solution

by:ReneGe
ReneGe earned 125 total points
ID: 35302753
Why not just making a batch file to directly change the PC's registry "fdenyaccess" to 0?

Cheers,
Rene
 
@ECHO OFF

REM ASSUMING THAT ALL PCs STARTS WITH \\PC

SETLOCAL enabledelayedexpansion

IF EXIST "%~N0.log" DEL "%~N0.log" >NUL

FOR /F %%A IN ('net view ^| Findstr -i "\\XP"') DO (
	ECHO ENABLING RDP ON: %%A
	REG add "%%A\HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t reg_dword /d "0" /f
	IF !errorlevel! NEQ 0 ECHO %date% %time% ERROR:%%A>>%~N0.log
)

PAUSE
EXIT

Open in new window

0
 
LVL 3

Author Closing Comment

by:venkatspb
ID: 35413655
Thanks
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 35413657
Glad i'v helped.

Cheers,
Rene
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question