Over 1 million tech questions and answers.

batch file/script help!

Q: batch file/script help!

Me and my friends are constantly plagued by Local Area Network connection issues when trying to connect to each other for streaming, game, etc. I was wondering how to create a file (like a batch file or script) that would execute the following commands to make the process quicker and easier to set computers up for a LAN.

- disable windows firewall
- disable/enable network adapters
- end unneeded processes such as ituneshelper.exe, ApplemMobileDeviceService.exe, etc.
- set computer's IP address to a specific static one (i.e. 192.168.1.10) as well as dns servers to particular settings

The whole point is to ease the process of connecting several computers on short notice in a short amount of time. I just need help learning how to write such a script or batch file or something that can execute all these things.

Thank you in advance for your help

RELEVANCY SCORE 200
Preferred Solution: batch file/script help!

I recommend downloading and running Reimage. It's a computer repair tool that has been proven to identify and fix many Windows problems with a high level of success.

I've used it in the past to identify and fix everything from blue screens (BSOD's), ActiveX errors, corrupt files and processes, dll/exe/sys errors, recover lost memory, Windows update problems, defragging, malware removal etc.

You can download it direct from this link http://downloadreimage.com/download.php. (This link will automatically start a download of Reimage that you can save to your computer.)

A: batch file/script help!

a lot of those would probably be done via netsh
netsh /? for help
(I haven't played with this much, but I'm sure it's not too hard to figure out, you have to play with it a lot though)
for example http://social.technet.microsoft.com/...9-df9eb5700561 for windows firewall

tskill for ending processes

Read other 9 answers
RELEVANCY SCORE 69.2

How can I do a batch file that automate the archival storage operation with a batch file?

thank you,

[email protected]
 

Read other answers
RELEVANCY SCORE 69.2

Well, I'm sitting here and can't this to work right.
Here's what I want to do:
- Login to a ftp server
- Download qconsole.log from demott
- Upload the same file to another folder at the remote server. (/logs)

Then the next thing:

I want then to upload this file from /logs to another FTP server, could anyone give me an example how to do that? Anyway here's my code:

Script.bat
Code:
FTP.EXE -s:SCRIPT.TXT

Script.txt:
Code:
open **.***.**.*** [COLOR=Red](IP)[/COLOR]
******** [COLOR=Red](USERNAME)[/COLOR]
******** [COLOR=Red](PASSWORD)[/COLOR]
lcd c:\logs
quote PASV
cd /demott
quote PASV
get qconsole.log
cd /demott/logs
quote PASV
put qconsole.log

 

A:Help with a Batch file script (FTP)

Hi mariusk,

Welcome to TSG !

You may adapt your script this way :
Code:
[SIZE=2]
open **.***.**.*** (IP)
******** (USERNAME)
******** (PASSWORD)
lcd c:\logs
quote PASV
cd /demott
quote PASV
get qconsole.log
cd /demott/logs
quote PASV
put qconsole.log
[COLOR=Red]close
open **.***.**.*** (NEW IP)
******** (USERNAME)
******** (PASSWORD)
lcd c:\logs
quote PASV
cd /logs
quote PASV
put qconsole.log
quit[/COLOR][/SIZE]

 

Read other 2 answers
RELEVANCY SCORE 69.2

I need to write a batch file or vb script that will take the following share names (which are stored in a .csv Excel file) and then run the following command:

NET USE \\[entry from 1.csv file]

The object is to have this command establish a NET USE connection to each share name from the 1.csv file.
These are the first five entries from the 1.csv file:
\\s0002234\c$
\\s002631\c$
\\gb2130\c$
\\s00460\c$
\\gb2143\c$
\\gb3205\c$

Can you please write a command script that will do this for me? My OS is Windows XP Service Pack 2.
Contact me with any further questions.
Dennis
[email protected]
 

Read other answers
RELEVANCY SCORE 69.2

Backround: I am a college student majoring in Information Technology with a focus in programming. I also work for my school's IT department as an IT associate. I have 4 years of experience dealing with hardware and software and have studied Net+ and A+ certification books.

Problem: At my school my boss, the IT Director, wants to schedule a batch file to run weekly that will delete items from the desktop and folders of the "Student" account on all of the student computers. He asked us associates to go around to every student computer with this batch file on a thumb drive and schedule the task. Seems simple enough right? The problem is we are talking upwards of 300 computers throughout the campus. I proposed a solution to him where we would use a script that would essentially consult a text document with the names of all of the student computers in it, then run the file.

I am 99% this can be done, I just have a very small amount of programming experience. If anyone has an answer or knows of an easier way to accomplish this I appreciate it. Thanks in advance.

EDIT: All student workstations are running Windows XP SP2
 

A:VB Script to Run a Batch File and Utilize a Text File

Read other 16 answers
RELEVANCY SCORE 68.8

At work i use 2 different PDF viewing software. One is Adobe for editing and the other is Foxit for quick viewing. They have their pros and cons and so I use them interchangeably.

For some work I will use Foxit for several hours at a time and only open something in Adobe on an as needed basis using the right click "open with" context. The opposite is true, for some work I use Adobe for hours and then use Foxit as needed with "open with" context.

I want a registry file or some application that will enable me to simply double click on it and KNOW that my file association for PDF is now Foxit (or Adobe depending on what batch or registry file I double click on).

I see there is "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ Explorer\FileExts\.pdf" which changes when I edit the file association in control panel. It does update, but I can't manually change the "UserChoice" Progid item. It changes only through file association in control panel.

I realize there are some in HKEY_CLASSES_ROOT but they dont update when i update it in file association in Control panel.

I don't know what to do or where else to look. It is tedious to have to go to the control panel -> file association manually.

Can someone help?

A:PDF file association REG or Batch Script

As for Foxit file association, that is easy.
Code:
"PathTo\Foxit Reader.exe" -Register
should do the trick.

But with Adobe Reader that is more complicated.
You can run repair function of it's MSI package with parameters /fum (f -to allow further parameters, u - rewrites user specific registry entries, m - rewrites other registry entries).

Or you can use registry monitoring software (some even in trial mode) like Total Uninstall to see what values are changed when you switch between Abode and Foxit. Once you will get these changes you can create two reg files for both cases. Or just one for Adobe and use code above for Foxit

Read other 1 answers
RELEVANCY SCORE 68

I tried looking a little on google, and couldnt find much. I need to make a batch file to add dns suffixs to local area connection.

i have a script that i tested but it didn't work, because i beleive it was for just the 2 local dns's and not for the dns suffixes.

Any help is a appreciated.

Update i found a script here. That works for now. Just need to figure out how to set it so it manually checks those 2 boxes.

On Error Resume Next

strComputer = "."
arrDNSDomainSuffixSearchOrder = Array("dns1.com", "dns2.com", "dns3.com")

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNicConf = objWMIService.Get("Win32_NetworkAdapterConfiguration")

WScript.Echo VbCrLf & "DNS Host Name: " & strDNSHostName & VbCrLf & _
" Attempting to enable DNS"
intEnableDNS = objNicConf.EnableDNS(strDNSHostName, strDNSDomain, _
arrDNSServerSearchOrder, arrDNSDomainSuffixSearchOrder)
If intEnableDNS = 0 Then
WScript.Echo " Successfully enabled DNS."
ElseIf intEnableDNS = 1 Then
WScript.Echo " Successfully enabled DNS." & VbCrLf & " Must reboot."
Else
WScript.Echo " Unable to enable DNS."
End If

WScript.Echo VbCrLf & String(80,"-")

Set colNicConfigs = objWMIService.ExecQuery _ ... Read more

Read other answers
RELEVANCY SCORE 68

So I have folders full of tv shows and a program that gives them all matching thumbnails but it saves them as .tbn files and my media server wants .jpg. So i wrote this script to run from my vidoes folder which contains all my tv shows.

Code:
@for /r %%i in (*.tbn) do ren "%%~fi" "%%~ni.jpg"
But now I am using xbmc as well and it looks for many thumbnails as .tbn so I want to change the script to rename any .tbn that is not named season00.tbn (00 being any two digits). If anyone could help me code this it would be much appreciated I tried for hours cause I know it should be a very simple if statement added in there but everything I try either stops renaming anything or still renames everything.
 

A:Solved: Help with a File rename Batch script!

Read other 8 answers
RELEVANCY SCORE 68

I need script to change my WiFi IP to specific IP as well as DNS and then change back to DHCP.
I need to work on both College and Home network. So I am looking for script which changes WiFi IP.

I have got two files. But I am not sure whether it will work. Somebody help me in verifying the script. If it appears to be wrong, then please provide the correct script.

College IP script: 
@ECHO OFF
netsh interface ipv4 set address name="Wi-Fi" source=static addr=172.16.20.131 mask=255.255.240.0 gateway=172.16.16.2
netsh interface ipv4 set dns name="Wi-Fi" source=static addr=172.16.16.2
netsh interface ipv4 add dns name="Wi-Fi" addr=8.8.8.8 index=2
:EOF

Home IP script:
@ECHO OFF
netsh interface ipv4 set address name="Wi-Fi" source=dhcp
netsh interface ipv4 set dns name="Wi-Fi" source=dhcp
ipconfig /renew
:EOF

Please help me in verifying and identifying the working script to switch between college and home network IP.
Thanks in advance. Looking for a positive reply in soon.

Read other answers
RELEVANCY SCORE 68

Assume I have a csv file (eg config.csv) set out as follows:

A,B,C
1,abc,def
2,ghi,jkl

I would like to be able to pass a batch script a parameter that uniquely identifies a line (record) in the csv file, eg:

script.cmd 2

and have the script then:

- read the line of the csv file that corresponds to the parameter given (ie 2,ghi,jkl) and
- set variables by parsing this line, eg:

set B=ghi
set C=jkl

I am very new to any form of coding, including batch scripting. I've read the help on FOR statements and searched the net and this forum but am hoping someone might be able to point me in the right direction, help me get started or provide a solution.

Thanks.
 

A:Parse csv file to set batch script variables

Read other 7 answers
RELEVANCY SCORE 68

I am making a batch file that moves an .exe file. whenever it moves the file the extension(.exe) gets removed and the file type is just "file". this doesnt happen with regular files like .txt .jpg ....
 

A:Solved: Batch script help with file extensions

Read other 7 answers
RELEVANCY SCORE 68

I need to script/batch a way of changing file permissions on a whole directory tree. Any ideas on how to do this?
 

Read other answers
RELEVANCY SCORE 68

For starters i would like to apologize about my bad English, i don't use it that frequently so might have a hard time to express myself good enough for you to understand what im trying to do.

I have a .csv file where A1 and B1 will be having constant values, the values are A1 = Name B1 = Order number.

Im trying to figure out if a script could help me to populate the cells beneath A1 and B1?

If it could ask me for name: and then i would have to type in a name that would populate A2, A3, etc. Perhaps it could also ask me for the amount? so if i put in the name "Adapter" and then it asks me for amount where i type in 10 it would put the word "Adapter" in A2-A11

I would also like it to ask me for an order number that would be put into A2-A11 in this case.

The amount that i would like to put in will vary from time to time.

IThis is what i would like the CSV file to look like after inserting the name "Adapter TKS-B" and the amount: 29 along with the order number: 123456. Hopefully you will understand how i want to populate the .csv file.

Is this possible? Again im terribly sorry for my bad English.

Thanks in advance
 

Read other answers
RELEVANCY SCORE 67.2

Hi I am looking powershel script to ran batch file for mutiple machines sceanrio is i have a batchfile and needs to ran on mutiple machines kindly help me how to run bat file in mutiple machines

Read other answers
RELEVANCY SCORE 67.2

Hi all,
I am new to Scripting so i need you people help.
I need a batch file to stop a service in services.msc and replace the .afxm file in c directory with with latest .afxm file
and start the service which stopped at first.
Regards,
Saravanan 

Read other answers
RELEVANCY SCORE 67.2

Hi everybody - My problem is that I have 100 identical printers, all the printers have network connectivity onboard.

I want to create 100 print queues for these printers, however I don't really want to add each lpr port/print queue manually !! Is there anyway that this can be done via script or batch file ??

Thanks in advance

Ron
 

Read other answers
RELEVANCY SCORE 67.2

Hi all,

I need to write 1 batch script to move the files from FTP location to my remote server location. seems both are in same network.

but when i give ftp command from remote server where i need to get files, it connected to the FTP server and shows all the files of ftp server while doing DIR.

pls help me to write the script as i m new to batch script. i need to call this script thro informatica command task. so that i can use those file to load my warehouse.

Its an urgent issue.
thanks in advance

Read other answers
RELEVANCY SCORE 66.4

I have some programs I prefer to run early in the a.m., and am used to being able to wake up my machine from sleep with a powershell script or batch file to get things going.  The script or batch file no longer function to wake the P50.  Also, it won't wake when I press a key on the keyboard (as all of my previous machines have). I've noticed my P50 will wake from sleep if I move the mouse around, and I'm wondering if the issues are all somehow related. Is there a setting (or settings) I need enable / disable to get the plain vanilla wake capabilty working again?  Any advice is appreciated.  Thanks!

Read other answers
RELEVANCY SCORE 66.4

Need aid in figuring out how to set the _Var(x) variables read in from the text file (which contains directory listings) file to either new variables or a way to incrementally reference (_var1, _var2, _var3...) in an IF or FOR statement later in the batch file. ISSUE - the second IF will not iterate properly the string saved from the input file in _var1, _var2, _var3....

CODE SNIPET:
SET cnt=1
SET cnt2=1
SET SYNCCmd="C:\Program Files\SyncLaptop\SYNC.CMD"
.
.
.
SetLocal EnableDelayedExpansion
::This line is just in case n has been defined before the batch file is run
::This FOR loop works flawlessly - reads in all file paths to _var variables
Set n=
Set _InputFile=c:\TEMP\SYNCLOG\SyncDirList.txt
For /F "tokens=*" %%I IN (%_InputFile%) DO (
Set /a n+=1
Set _var!n!=%%I
)
:: Line will display the variables just assigned - delete when not needed
Set _
Pause

:: LOOP through directory listing variables _var(x) until there are no more
:SYNCRO
IF %%_var!cnt!%=="" GOTO CLEANUP
ECHO first variable is: %_var!_cnt!%
SET _LocalDrv=_var%_cnt%
SET /a _cnt2=_cnt+1
SET _NetDrv=_var%_cnt2%

:: Check if real directory values where set to the variables - delete later
ECHO LocalDrv is: %_LocalDrv%
ECHO NetDrv is : %_NetDrv%
pause
:: Open net CMD window, set color etc & call the XCOPY SNYC.CMD file to sync the two designated HD folders
START /W CMD /C "ECHO OFF & CLS & MODE CON: COLS=60 LINES=15 & COLOR 74 & %_SYNCCmd% "%_LocalDrv%&quo... Read more

A:Batch Script - Variable issue from parsing an input file

Welcome to TSG!

You initialize these

Code:
SET cnt=1
SET cnt2=1

Note there is no leading underscore.

This line uses the correct name, but should not have the doubled % symbol, just a single one:

Code:
IF [COLOR=Red]%%[/COLOR]_var!cnt!%=="" GOTO CLEANUP
Should be
IF %_var!cnt!%=="" GOTO CLEANUP
But these use a leading underscore:

Code:
ECHO first variable is: %_var![B][COLOR=Red]_[/COLOR][/B]cnt!%
SET _LocalDrv=_var%[B][COLOR=Red]_[/COLOR][/B]cnt%
SET /a [B][COLOR=Red]_[/COLOR][/B]cnt2=[B][COLOR=Red]_[/COLOR][/B]cnt+1
SET _NetDrv=_var%[B][COLOR=Red]_[/COLOR][/B]cnt2%
Change the variables so all are consistant, either using an underscore or not.

Also, you are setting the _LocalDrv and _NetDrv variables to _var+the number in _cntX. These lines should be:

Code:
SET _LocalDrv=[COLOR=Red][B]%[/B][/COLOR]_var[COLOR=Red][B]![/B][/COLOR]_cnt[COLOR=Red][B]![/B][/COLOR]%
SET _NetDrv=[COLOR=Red][B]%[/B][/COLOR]_var[COLOR=Red][B]![/B][/COLOR]_cnt2[COLOR=Red][B]![/B][/COLOR]%
Set _var= only clears one variable named _var. It won't clear _var1 or any others.
If you want to clear all of the _varX variables use this loop:

Code:
For /F "Tokens=1 Delims==" %%I In ('Set _var') Do Set %%I=
Use ('Set _') to clear all variables that start with an underscore.

HTH

Jerry
 

Read other 1 answers
RELEVANCY SCORE 66.4

I was wondering if there was a way to create a set of folders in a specific directory according to a date range that i input.

ie.

Select start date 2011 10 01

select end date 2012 10 01

Select Output path of c:\users\XXXX\desktop\export data

and it creates a folder for all days from 2011 10 01 through 2012 10 01 and places them in the output path i have set for it.

any help would be greatly appreciated.

Thank you

A:Is there a Script or batch file that can create folders by date range

Welcome damjohnron to the windows 7 forums.

Here are some snippits of a dos batch file that will create a directory with the datek and tell you if it already exists.


set DATEST=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%
echo %datest%
rem if it looks ok, then you can press enter to continue
pause
if exist %homepath%\documents\%datest% goto dup1
md %homepath%\documents\%datest%
rem the pause can be taken out if you wish.
pause
go to end
:dup1
rem you already have done this.
pause
:end

you can change the path statement to the directory you wish.

This batch file can be run each day that you want to create a new sub directory.
There are other ways to do this but a bit more complicated such as reading an external
text file for the directory names.

Rich

Read other 4 answers
RELEVANCY SCORE 66.4

I have the following batch script


Code:
@echo off

setlocal enableextensions

set "baseName=dnshistory"

set "count=0"
for /f "delims=%baseName%." %%a in (
'dir /b /o-d "%baseName%*.txt" 2^>nul'
) do ( set /a "count=%%a+1" & goto saveData )

:saveData
ipconfig /displaydns | find "Record Name" > "%baseName%%count%.txt"
The problem is that when i run it on my windows 7 desktop, it creates an empty txt file in comparison to my windows 8 laptop, where it creates the dns record that i need.

Does anyone knows why this happens on windows 7 ?

A:Windows 7 creating blank txt file after running a batch script

Usually inserting a bunch of "echo" statements will give a hint what's wrong. Just like using MsgBox in other programming languages.

Read other 3 answers
RELEVANCY SCORE 65.6

Hello,
I am trying to schedule a task while loads MySQL batch script (.sql) file but the command is not executing as given and expected. Rather it's printing MySQL help usage information. My task action configuration would be:
Program/Script: "D:\Workspace\Tools\mysql-5.6.25-winx64\bin\mysql.exe"
Arguments: -u username -ppassword <databaseName> < "D:\<batch-script-file-name>.sql"

It's running successfully while running through command prompt but not working using task scheduler. Rather it give mysql help usage information. Any idea about it's behavior?
Thanks

A:Using Windows 7 Task Scheduler To Load MySQL Batch Script File

Instead of scheduling mysql.exe, you should schedule a batch file that contains the whole command and its parameters. This makes debugging much easier. Let's call the batch file D:\Workspace\MyBatch.bat:
MyBatch.bat
@echo off
set Log=d:\Report.log
echo Job run on %date% at %time% by %UserName% >> %Log%
D:\Workspace\Tools\mysql-5.6.25-winx64\bin\mysql.exe -u username -ppassword d:\MyDatabase D:\MyScript.sql  1>%Log  2>&1
echo. >> %Log%
You should now do this:

Run the batch file from a Command Prompt.
Examine the log file.Run the batch file from the Task Scheduler.Examine the log file again.

Read other 4 answers
RELEVANCY SCORE 65.2

I would like to copy all pdf files from  directory 'src' and sub-directories 'src/src-sub1' to directory 'trgt', including the directory structure. Any suggestion? thanks!

A:windows batch script to recursively copy file/directory of a specific patern

Hi,
I have to use windows batch script and buildin commands. Any suggestion is welcome. Thanks!
Both are available in batch:
Robocopy: http://ss64.com/nt/robocopy.html
XCopy: http://ss64.com/nt/xcopy.html
Don't retire TechNet! -

(Don't give up yet - 12,700+ strong and growing)

Read other 9 answers
RELEVANCY SCORE 62

I am having a problem with a batch script that prompts a user to enter a set of responses which then set variables - Then the script will call in another batch and writes the output to a new Batch file.

The problem is the batch file doesn't output the new Batch file the way I intended.

This is the script I have:

BEGIN.BAT

:START
@ECHO OFF
CLS
ECHO.
ECHO Please enter the full filename reference (e.g. 1-210208)
ECHO.
SET REFERENCE=
SET /P REFERENCE=
CLS
ECHO.
ECHO Please enter the full description (e.g. 12:15 on Thursday 21 FEBRUARY 2008)
ECHO.
SET Description=
SET /P Description=
CLS
ECHO.
ECHO Please enter the date reference (e.g. 210208)
ECHO.
SET DTE=
SET /P DTE=
CLS
ECHO.
ECHO Please enter the reservation slot time (e.g. 1215)
ECHO.
SET TME=
SET /P TME=
CLS
ECHO.
ECHO Please enter the script file you are replacing (e.g. 001)
ECHO.
SET Replace=
SET /P Replace=
CLS
ECHO.
ECHO Please enter the continuing script file (e.g. 002)
ECHO.
SET NxtFile=
SET /P NxtFile=
CALL "\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\ADMIN\TEMPLATE.CMD">"\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\DATES\%Replace%.BAT"
CLS
ECHO.
ECHO REPLACEMENT OF %Reference% completed!
PAUSE
GOTO START

TEMPLATE.BAT

ECHO @ECHO OFF
ECHO CLS
ECHO IF EXIST "\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\%REFERENCE%.TXT" (
ECHO GOTO NEXT
ECHO ) ELSE (
ECHO GOTO EXIST
ECHO )
ECHO :EXIST
ECHO ECHO.
ECHO ECHO %DESCRIPTION% IS AVAILABLE
E... Read more

A:Help with Batch script that creates a Batch script

Try This

Template.Bat
Code:

@ECHO OFF
CLS
IF EXIST "\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\%REFERENCE%.TXT " (
GOTO NEXT
) ELSE (
GOTO EXIST
)
:EXIST
ECHO.
ECHO %DESCRIPTION% IS AVAILABLE
ECHO.
ECHO Would you like to reserve this time?
ECHO.
ECHO Yes (Y) or No (N) or Cancel (C)
ECHO.
:ERROR
SET CHOICE=
SET /p CHOICE=Enter response to continue (Case sensitive):
IF not '%choice%'=='' set choice=%choice:~0,1%
IF '%choice%'=='Y' goto YES
IF '%choice%'=='N' goto NEXT
IF '%choice%'=='C' goto CANCEL
ECHO "%choice%" is not valid please try again
ECHO.
GOTO ERROR
:YES
ECHO %DESCRIPTION%>>"\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\ %REFERENCE%.TXT"
ECHO RESERVED BY %FullName%>>"\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\%REFERENCE%.TXT"
ECHO LOCATED ON %Team%>>"\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\%REFERENCE%.TXT"
ECHO STAFF ID IS %USERNAME%>>"\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\%REFERENCE%.TXT"
ECHO "%DATE%","%TIME%","%USERNAME%","%FullName%","%Team%","%DTE%","%TME%">>"\\hb eu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\LOG\AUDIT.CSV"
ECHO.
ECHO Thank you %FullName% - Your reservation has been successful.
ECHO.
PAUSE
:NEXT
CALL "\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\DATES\002.BAT&quo... Read more

Read other 3 answers
RELEVANCY SCORE 60

Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can...

First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg.

Here's the code that I'm using:

ffmpeg -i folder\video.mp4 -f mp3 -ab 160000 -vn "\different folder\music.mp3"

what I would like to do is add to this so that I don't have to write out this code for every file I have... :/

I have the mp4 files in one folder and than the mp3 files are saving to another folder.

So here's an example of what the code will do if it isn't clear yet.

Folder 1:

video1.mp4
video2.mp4
video3.mp4

what it should do is grab video1.mp4 and convert it.

ffmpeg -i folder\video1.mp4 -f mp3 -ab 160000 -vn "\different folder\music1.mp3"

and than move onto the next one

ffmpeg -i folder\video2.mp4 -f mp3 -ab 160000 -vn "\different folder\music2.mp3"

and than the next one

ffmpeg -i folder\video3.mp4 -f mp3 -ab 160000 -vn "\different folder\music3.mp3"

It's going to have to grab the name from the mp4 file and insert it for the mp3 file.

I can get around pretty good in cmd if it's basic commands but when it comes to something like this I'm a little confused...

Thanks for the help in advance!
I'll see what i can do about searching some more on what I would have to do and if I find the solution I'll post it here if it isn't already answered.

A:Batch File that grabs file names from folder to insert into batch file

A DOS "for /f" loop should do the trick, although changing the filename extension for the output to do everything in one line escapes me at the moment.

Perhaps you could do a dir .\folder\*.mp4/s/b > mp4s.txt, then make a copy of that and edit each line to rename the file to the destination name, and save it as mp3s.txt. Then you just feed both the source (mp4s.txt) and destination (mp3s.txt) filesnames into the for /f loop which handles the ffmpeg conversion.

Quite a crude solution and you'd have to handpatch the destination filenames, but i can't think of how to get a source mp4 filename and then just change the extension.

Read other 3 answers
RELEVANCY SCORE 59.2

Hi,
I have a question  that how to copy file from remote desktop user drive to my local machine using  xcopy or any other protocol.

This is my server path "\\Trail01" and here is the file location "c:\Users\ashique.sheikh\Desktop\Day2.R"
How can i give this is in my batch file. I have used this
net use "\\Trail01" "[email protected]" "/USER:ashique.sheikh"
XCOPY /Y \\Trail01\c:\users\ashique.sheikh\Desktop\Day2.R  "D:\VMI"
But its not working. It is give path error.
How can i download this or is there any other way to do it?

Read other answers
RELEVANCY SCORE 54.8

If someone can Please help, I just need the Data in the XML tag extracted to Batch File Variable....the rest i figured out and works great for the backup...just need the extracted tags...
thank you

i have a parent directory that contains a sub directory and a XML file that i need a batch to read 2 specific tags then create a Set command in the batch with those 2 lines to create a backup folder with the tags as the names and such. looks like this:

Parent Directory = XML
XML Folder contains > WJFKB02229001.D Folder & Config.xml File

I need to read the contents of the xml "Config.xml" extract the PhaseID Tag data "WJFKB02229001"
Also need to extract the BoxID "D", I don't need anything else on these seperate lines.

keep trying the following For /F command but no luck
Code:
[COLOR=red]for /f "tokens=1 delims=[" %%G in ("PHASEID" %path%\%myfile%) DO ([/COLOR]
[COLOR=red]set PhaseID=%%G[/COLOR]
[COLOR=red])[/COLOR]
[COLOR=red]echo Phase: %PhaseID%[/COLOR]
pause

and i've searched so many sites and forums with no real help on this one....the data is contained in the xml, weird enough i guess that it's enclosed in brackets "[", which all the forums i read and try it either replies with a blank variable being passed or says it can't find the file at all....

PLEASE HELP, lol

Code:

:StartSet
Set PhaseID="[COLOR=red][B][I]Extracted PhaseID from xml[/I][/B][/COLOR]"
Set BoxID="... Read more

A:Solved: Batch File Extract TAGID to Batch Variable? weird

Read other 16 answers
RELEVANCY SCORE 54

Hi,

I have my vendor's ftp url over SSL. it's like ftps://myvendor.com and i have username and password. So please help me on writing batch script t o downlod the file from my vendor repository.
If this is not possible in dos script, please suggest me opensource tool. But i would love the solution in dos script as i need to use this forever to avoid any manual work.

Thanks

Read other answers
RELEVANCY SCORE 54

Hi Ime Quite New here I Know A Little on Batch Scripts but i need Help Please

1.)How Can I Bypass UAC In Vista Without Restart In Batch Script
2.)How Do I delete All Files And Folders In My %TEMP% Without Confirmation
3.)How Can I Enter Text Into A Batch Script And Then Have The Script Save It As "info.ini"

Saved File Info.ini should read

Code:

[General]
Name= Entered Text
Model= Entered Text

[Support Information]
Line1= Entered Text

Any Help Or Just Point Me In the Rite Direction Please

Please

Thank you Mobile-latham
 

A:Help With A Batch Script Please

Ok Worked The delete %TEMP%
FOR /F %%A IN ('DIR /B /AD /S') DO RMDIR /S /Q %TEMP%\
 

Read other 2 answers
RELEVANCY SCORE 54

dear all
any help to make batch script this the reason i want to make a batch file is to help me update the online games in 60 computers by overwriting or copying big files in one click from 1 source computer...
instead of turning on all 60 computers and updating all online games, he'll just have to update one computer and just copy the update or overwrite the old files in all 60 computers...

i have 1 server game i want only copy newer files to pc all pc client
example
pc server = 192.168.3.200
pc -01 = 192.1683.1
D\gameonline\dota2\
how to batch script

thx before

A:batch script help

i try to make script but no work
this my scripy

@echo off
set "pc_server=\\192.168.3.77\D\GameOnline\DOTA 2\"
set "pc-24=\\192.168.3.24\D\DOTA 2\"
robocopy /"%pc_server%/" /"%pc-24%/" /mir

Read other 6 answers
RELEVANCY SCORE 54

how can I start the service: "wireless zero configuration-service"
with a script or batch file?
witch code do I need?

OS Windows XP prof SP2

Thanx Mark
 

A:script or batch

Is it listed in the list of services in the services manager?
 

Read other 2 answers
RELEVANCY SCORE 54

Hi, I just had a question about a script I'm trying to make for hiding/unhiding folders.

Here is the script I have come up with so far:

Code:
cls if exist "C:\Documents and Settings\Tom\Desktop\GM Games\folderlock\test" goto lock else goto unlock :lock echo off attrib "C:\Documents and Settings\Tom\Desktop\GM Games\folderlock\test" +s +h goto end :unlock echo off attrib "C:\Documents and Settings\Tom\Desktop\GM Games\folderlock\test" -s -h goto end :end exit

For some reason, it works to hide the folder, but when you click it after it hides the folder, it does not reveal the file again,
yet if I run the line "attrib "C:\Documents and Settings\Tom\Desktop\GM Games\folderlock\test" -s -h" in a separate batch file, it works fine...

Theres got to be something wrong with my script that is stopping it from running the "unlock" line...

Any ideas?
 

A:Need help with batch script

Read other 16 answers
RELEVANCY SCORE 54

Hey im trying to create a batch script that will create the pattern for IP address's

I started with code that looked like

:loop1
set /a four="%four% + 1"
if ("%four%")==("9") goto loop2
echo %one%.%two%.%three%.00%four%
%cmd% >>"C:\%cmd%.txt"
if not ("%four%")==("9") goto loop1

:loop2
set /a four="%four% + 1"
if ("%four%")==("99") goto loop3
echo %one%.%two%.%three%.0%four%
%cmd% >>"C:\%cmd%.txt"
if not ("%four")==("99") goto loop2

:loop3
set /a four="%four% + 1"
if ("four")==("255") goto loop4
echo %one%.%two%.%three%.%four%
%cmd% >>"C:\%cmd%.txt"
if not ("%four%")==("255") goto loop3

which worked to an extent but once it hit loop3 it would continue adding to the next set of numbers and not reset itself back to 0.

how to i create a bunch of loops for creating the pattern for an ip address (000.000.000.000) from 0-255.

I read into the For /L command but wasnt successful at figuring it out.

Thanks

Read other answers
RELEVANCY SCORE 54

I have a batch file I just need ran on and after certain days/dates.. these days vary.

So here is my question..

I want to create a file that I can put in the start up menu, so when my computer boots up it will run this file and check

the date. If the date is for example: november,18,2009 or later it will run the batch file.


That batch file is located in c:\Documents and settings\user\My Documents

So what kind of file would I need to create and what would the script be.

I need to be able to plug in different dates when I need to and using the schedule task in windows is not going to work.

Time doesnt matter just need dates.

A:Script or batch

Welcome to TSF!

This should do it. Set the target date in the 2nd line. Use the same format and symbols as your system does, so if your computer displays the date for Nov 18 as 18-11-2009, use that, not 11/18/2009.

Set the file name of your batch file in the 3rd line. The 4th line is the path to the file, which will be the My Documents folder of the logged on user. If you want this to run for more than one user, you'll need to change that as well, and put the batch file into a folder all users can read.

You can put this batch file in your Startup folder, or create a Scheduled Task to run this batch when you log on.

Code:
@Echo Off
Set _TargetDate=11/18/2009
Set _FileName=mybatch.bat
Set _Filepath=%Userprofile%\My Documents\%_Filepath%
:: Get todays date
Call :GetDate
Set _yy=%_fDate:~,4%
Set _mm=%_fDate:~4,2%
Set _dd=%_fDate:~6,2%
:: Convert todays date to Julian
Call :JDate %_yy% %_mm% %_dd%
Set _JToday=%_JDate%
:: Get Target Date
Call :GetDate %_TargetDate%
Set _yy=%_fDate:~,4%
Set _mm=%_fDate:~4,2%
Set _dd=%_fDate:~6,2%
:: Convert target date to Julian
Call :JDate %_yy% %_mm% %_dd%
If %_JToday% GEQ %_JDate% Start "" "%_Filepath%"
Goto :EOF

::===================================::
:: ::
:: - S u b r o u t i n e s - ::
:: ::
::===================================::
:JDate
:: Convert date to Julian
:: Arguments : YYYY MM DD
::... Read more

Read other 3 answers
RELEVANCY SCORE 54

Hi,
Can somebody assist me with a .bat file I am trying to create?
This is what I have now:


Code:
start /d "C:\Users\Me\Desktop\ghost" ghost.exe
start /d "C:\Users\Me\Desktop" Poweroff.exe

C:\Windows\System32\powercfg.exe /setactive e428f8a5-615e-488f-b7f7-1ed39450e522
The first 2 lines start programs on my desktop. The next line, I try to change the power setting so my computer won't go to sleep, but I am not sure how to put this in my script. When I enter the line in command prompt, it works, but I am new to writing batch files.

What I essentially want to do is to run those two programs and set my power settings to another profile.
The second program shuts down my computer when the first program ends. It would be nice if I could do this in a batch file without the second external program support. Another idea I had was to start up GHost.exe (1st program) and then run shutdown -t 20, but I also need help expressing this in a batch file, so the line runs only after GHost.exe ends.

Thanks for your input.

A:Help me with Batch script!

Oh boy, it's been several years since I did a lot of batch file commands...

Looks like you might want to add the start " " to that 3rd line, thats the 1st thing that comes to mind.

Read other 1 answers
RELEVANCY SCORE 54

Hello All,

Greetings!

I am a BI guy.I need a batch script(.bat) for Winodws 7 enterprise edition.
My requirement:
I have some 100 files in a network drive which i can access.Each text file contains some 1000 records with some filed names.Now my question is i want to read those files and put result in another file.I dont want all the record of data in the text file. Now i need filename,record count,date of the file .

result file would be:
Filename record count date
Filename-1 100 01/dec/2017
filename-2 1000 01/dec/2017
filename-3 900 30/nov/2017. This i sthe data i need in a result file(like .csv,exel,.txt as result file)

At same time i have to increment automatically file when new file arrives into the directory.i,e i have executed file today i can see the files upto today.Tomorrow the file should run automatically and update the all files including history files....in the result text.This is because i use this file in a scheduled report in other technology where all these data to display.

I hope you understand.

Thanks in advance.
 

Read other answers
RELEVANCY SCORE 54

Hi,

I am trying to write a batch script, that will copy users "My Documents" Folder. I want to put a for loop in the script that will ping the computer first and if the ip address of the computer is in 10.10.10.0 to 10.10.10.200 range, then only it will prompt the user to copy enter user name, otherwise it will exit. This is what I got so far. It does the copy and prompt the user fine, but I don't know how to get the for or if loop working to decide only to do the backup for 10.10.10.0 to 10.10.10.200 range.
Code:

@echo off
Title "Back up My Documents"

ipconfig | find "IP Address" > ip.txt
for /F "tokens=* delims=:" %%I in (ip.txt) do GOTO copy

:Copy
start /wait NET USE /delete /Y z:
start /wait NET USE z: "\\servername"
set /p source="Enter your username: "
echo Please wait...Backing up My Documents...

If not exist "c:\Documents and settings\%source%" (echo You have entered wrong user name. Program will exit. Contact the admin. & pause & exit)

xcopy "c:\Documents and settings\%source%\My Documents\*.*" "z:\%source%\My Documents" /e /q /r /h /d /k /c /y /i

end if

start /wait NET USE /delete /Y z:
exit
Thanks for all the help
Jat421
 

A:Batch script

Read other 9 answers
RELEVANCY SCORE 53.6

I want to be able to run chkdsk on all my drives at start-up before much has loaded. It would appear I need to write or find a batch script file to carry out this task. I found the following script on a google search:[email protected] y|chkdsk c: /[email protected] y|chkdsk <next drive letter>: /[email protected] y|chkdsk <next drive letter>: /[email protected] y|chkdsk <next drive letter>: /[email protected] y|chkdsk <next drive letter>: /fetcetcThe | character is shift+backslash.This batch script is placed in the root of the boot drive (c: in my case) and executed via a shortcut from the desk top. The problem for me is that the script runs immediately, skips the c: drive but does offer the option of y/n to scan it at next boot, the script then goes on to check the other drives. There is no time delay after the skipping of the c: drive to select either y/n option and it does not check the drives at boot-up.Please could someone tell me how to alter the script or tell/show me an alternative method. The other thing is that I would like to be able to view a log of the scan/check.Cheers.

A:altering batch script

How many drives and what size are they?
Do you suspect that one of the drives might be failing?

I think that this will slow down the boot process dramatically & there really is no need to run chkdsk on startup unless you suspect a hard drive problem.

Read other 4 answers
RELEVANCY SCORE 53.6

I have a program that requires multiple steps to load (click on the icon then select the data folder ect...) I would like to write a batch file or script that would automate the process for the end users. Is there a good tool for doing this or examples of the code I could use???
 

A:Script/batch files

gtbwill,

Batch files are a lost art but they still work.
The following site has info on how to create different types of files: http://www.robvanderwoude.com/

Regards,
Roger
 

Read other 1 answers
RELEVANCY SCORE 53.6

Hi All,

I am writing a dos batch file for windows7 and it has many commands which need elevated access to run. For elevation I am using elevate.exe. I am doing like below -

set Elevation=elevate -wait cmd.exe /c
%Elevation% "cd /d %CD% && xcopy /E /Y ...."
%Elevation% "cd /d %CD% && command 2 .."
%Elevation% "cd /d %CD% && command 3 .."
%Elevation% "cd /d %CD% && command 4 .."
.....

My script calls elevate for cmd and then "cd /d %CD% for each command as elevate changes the working path to /system32 I am forced to change the directory every time I run elevate. It also prompts user for "UAC" dialog for each elevate command, so for ten such command UAC prompts will come 10 times . Commands I am using are mix of DOS command(like xcopy, diskpart etc) and some other 3rd party executable. So there is two problem for which I need some help-

1. How to call elevate for cmd.exe once and run rest of the command in same elevated console.
2. How to change working directory once instead with every command. I think solution to first one will take care of this also.

Any help is most welcome.

A:How to run cmd.exe elevated in batch script

Hi and welcome to SevenForums,

For batch files I run manually I set the shortcut for it to run as administrator and I get ONE UAC prompt.

I've never heard of elevate.exe

Read other 1 answers
RELEVANCY SCORE 53.6

Hi,

I have 1000 image url in my text file(sample.txt) and i want to download the images using the url. Can anyone please share with me the sample script which can do this in single shot.

Also, is there any way to reduce the size of the image into 20/20 px with png extension.

Thanks

A:Help Needed in Batch Script

hmmm im not very good with batch... but you can do this with wget.
your txt content is


Code:
www.pic.com/pic01.jpg
www.pic.com/pic02.jpg
right?

then get wget and use this command
wget -i sample.txt

and for resizing, get irfanview and use batch resize function.

Read other 4 answers
RELEVANCY SCORE 53.2

Hiya,

I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups.

Two questions:
1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd rather keep a standard 'workflow' for other users who use the machine.

2. I'm 'ok' with batch files, but i've never tried to mirror to a different folder each time (automagically). What i'd like to do is have it backup a folder and call it "blah.1" then "blah.2" each time it is run, and then repeat once it gets to "blah.9" so it doesn't keep growing forever. I don't know how to do this.

I realise no.2 is not really for this forum, but someone might know and i might as well ask

Thanks.

A:How to run a batch file at logoff & some batch scripting help please

I found an answer to the logoff/shutdown:
How to schedule a task to run when shutting down windows - Stack Overflow

And the batch file folders:
robocopy - Insert current date in to destination folder structure - Stack Overflow

Read other 1 answers
RELEVANCY SCORE 52.8

Hallo,

I wrote a Script that uninstalls an application, move some files and install an Application.
The Script is working if I start it as Admin (right click - run as Admin ...).
Everything works fine.

But I want to have it working without the "run as".
The script is only used in a separated Test system,
so there is no problem if the Admin user name and password is in the script.
(also link wouldn't work, should also work if it moves to another station within the test domain)

Is there a way to manage that?

A:Admin privileges in batch script

Batch command runas with a standard trick
echo password | runas
it is NOT going to work, because the password should be entered manually.

If you do not mind clicking Yes in UAC window you can use Elevate.exe
With it you won't need writing password anywhere
"C:\yourFOLDER\elevate.exe" "C:\yourScriptFOLDER\yourScript.bat"
would be enough to start script with admin privileges (still need to click YES on UAC window).

Read other 6 answers
RELEVANCY SCORE 52.8

Hello, i was trying to make a small batch script that backs up some directories on a network share and copies them to another network drive..

Can anybody point me in the right direction..

Think itīs just best i show you the problem in code:

--------------------------------------------------------------------------------------------------------------------
@echo off

::This code works..
::for comparison i made a version of similar backup script that works, but the only diffrence is that this script is run localy

set drive =\\"Network share that i have"\%username%$\backup
set backupcmd =xcopy /s /c /d /e /h /i /r /y

eecho ### backing up the desktop as an exsample...
%backupcmd% "%USERPROFILE%\Desktop" "%drive%\Desktop"
--------------------------------------------------------------------------------------------------------------------

@echo off

::This code does not work..
::This code is made for backing up computer (A) to network drive from computer(B)
::This code gives an error that a networkdrive is not found, but when i type in the location myself i can connect to the network location..

set /p nr = computer share name? :
set /p name = name of user to back up from? :
set computer = \\%nr%\d$\Documents and Settings\%name%

set drive = \\"Network share that i have"\%name%$\backup
set backupcmd = xcopy /s /c /d /e /h /i /r /y

echo ### backing up the desktop as an exsample...
%backupcmd% "%computer%\Desktop" "%... Read more

Read other answers
RELEVANCY SCORE 52.8

Morning i have a problem with batch script in Windows 7.
this is my code:

Code:
@echo off
set mypath=c:\tools
if not exist "%mypath%\architet.txt" goto check3264
find /I "x64-based PC" "%mypath%\architet.txt" >nul 2>&1
if %errorlevel% EQU 0 (set architet=64) ELSE (set architet=32)
goto uacok
:check3264
echo Find Windows 7 32 or 64 Bit
systeminfo.exe >"%mypath%\architet.txt" 2>&1
find /I "x64-based PC" "%mypath%\architet.txt" >nul 2>&1
if %errorlevel% EQU 0 (
echo 64bit Found
set architet=64
echo Disable UAC
"%mypath%\file\hstart64.exe" /RUNAS "WScript //Nologo c:\tools\uac.js"
goto restart
) ELSE (
echo 32bit Found
set architet=32
echo Disable UAC
"%mypath%\file\hstart.exe" /RUNAS "WScript //Nologo c:\tools\uac.js"
goto restart
)
:uacok
rem find if pc is Eeetop 2010
if exist "%windir%\EeeTOP.scr" (
echo EeeTop ET2010 Found
echo Removing components
del /F /Q "%windir%\EeeTOP.scr"
wmic nic list brief >"%mypath%\net.txt"
type "%mypath%\net.txt" | findstr /I "ethernet 802.3" | findstr /v /I wireless >"%mypath%\net2.txt" 2>&1
For /f "tokens=3" %%F in (%mypath%\net2.txt) Do echo 000%%F>"%mypath%\id.txt" 2>&1
rem *1
For /f "tokens=*" %%G in (%mypath%\id.txt) Do set networkid=%%G
REG ADD "HKLM\SYSTEM\ControlSet001\Control\Class\{4D36E9... Read more

A:Problem with echo in batch script

this appen only in the batch.. if i cut the part and insert into another batch this work

Read other 4 answers
RELEVANCY SCORE 52.8

I had a file, then I lost it. Don't know how I could possibly have lost it. Now, I am unable to find the shortcut that I used. It may have been a script. I don't recall which, but it was a button on my desktop and I double-clicked it to put my PC to sleep, instead of hitting the Start button, then choosing Sleep from the shutdown.

Bonus unrelated question: I've got 8. Should I install?

Thanks so much in advance for your help.
 

A:Batch/Script to Sleep Windows 7

first thing google found for me.
http://answers.microsoft.com/en-us/...tcut-for/4e57f536-50a8-4942-a84a-290b3dea1ffb
 

Read other 2 answers