Over 1 million tech questions and answers.

Run Batch File On Remote Computer Without PsExec

Q: Run Batch File On Remote Computer Without PsExec

Ok imma give a full rundown of the situation. Currently on the network we are on because of the way it is setup wake on lan doesn't work, so SCCM has at best a 70 success rate for patching. So I am currently spending a couple days a week remoting into computers and running a batch file to manually update computers. I need a way, that isn't psexec to execute a batch file on a remote computer. If anyone has any ideas they would be greatly appreciated.

Additional Notes
- Batch file is on share drive atm.

Preferred Solution: Run Batch File On Remote Computer Without PsExec

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: Run Batch File On Remote Computer Without PsExec

So, you are using RDP and remotely logging into the computer? If that's the case, you should be able to put the batch file on a network share, and then execute it while you are in the RDP session.

Read other 9 answers

I have created a couple batch files to easily update firefox on users computers. See the scripts below.

This executes a batch file on all computers listed in the firefoxusers.txt file.
psexec @firefoxusers.txt -u [I]AdminUsername[/I] -p [I]password[/I] c:\installers\firefox.bat
This is the file that is executed from the one above to install the file silently from a shared drive.
pushd \\server\applications\firefox

firefoxsetup.exe -ms

My problem is that when I run this script I have no idea if the software was installed correctly or not. I am looking for a way to just output what was run so I can go through and see if anything failed.

Any help would be appreciated.


A:Solved: Output log file from PSExec batch

Not sure if Redirection will work or not.

You could try this.
psexec @firefoxusers.txt -u AdminUsername -p password c:\installers\firefox.bat 2> errorlog.txt

or inside your batch file. Not sure if this one witll work or not.
firefoxsetup.exe -ms 2> \\server\applications\firefox\errorlog.txt

Read other 2 answers

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

hey guys,

i am in need to create a batch file that can add/remove admin rights from remote computers in my network. So far, i have been able to put together two file.....the first accepts the input which is the hostname OR IP address and the calls the second batch file to do the job....to remove admin rights. but facing a couple of issues which I was hoping you can help me with.

I am looking for a file which can
probably combine the below two to a single one (if possible)
can delete all domain users from the 'Administrators' group without removing the 'Domain Admins' group

can you look at the code and help me tweak it.

batch file to remove admin rights

@echo off
cd C:\pstools
set /p input= (enter hostname or IP address of the system to connect to):
psexec.exe \\%input% -u .\administrator -p password123# "C:\batch\1.bat"
the file (1.bat) that is called by the above file to add/remove admin users

@echo off
set /p "input=(domain username): "

if /i "%~1"=="add" goto :add1
if /i "%~1"=="del" goto :del
goto :EOF

"c:\windows\system32\net localgroup administrators" "domain\%input%" /delete
for /F %i in ('net localgroup administrators') do net localgroup administrators %i /delete
goto :EOF

c:\windows\system32\net localgroup administrators "domain\%input%" /add
goto :EOF

Read other answers


So here is my problem.

In work we get a number of calls from users getting various errors from password faults to corrupt Hard Drives.

What im looking to do in particular is have a BAT file created that will show who is currently logged on to a remote Computer.

The problem is that most of the Admin/Techy's have Limited accounts (no right click, no access to local Drive etc) i am one of 4 advanced users (out of 23 in an office) who have extra privilages compared to the rest of the office.

The OS used in work is Vista Enterprise SP2

I have tried creating BAT files that use nbtstat, but this doesn't retrive the info i need.

any help would be apreciated.


A:Possibility to have Batch file created to show logged on user on a remote Computer

Read other 13 answers

Hello Fangzhou CHEN,

Per your instructions below.  Is the U/P my admin info or the users?  Please advise.

We could use the PsExec tool to conduct the remote control.
1. Download the tool and copy to file to C:\Windows\System32

2. Run cmd as administrator
3. We could run the command psexec  \\ <computername >
-u <username> -p <password> <command>to run command in remote computer.

Read other answers

So I am looking to create some kind of batch file or script where I can click on it....it asks for the machine name, I enter it and then it displays the last logged on user. The following command
" wmic /NODE:"computername" computersystem get Username" gives me the desired results but I am trying to automate the process. I appreciate any help

A:How to Create a Batch file for last logged on for a remote use

Like this?

ECHO Type the machine name, press ENTER, Ctrl+Z, ENTER
FOR /F "tokens=*" %%A IN ('TYPE CON') DO SET INPUT=%%A
wmic /NODE:"%MACHINENAME%" computersystem get Username | find "\"
Put that in a bat file and run it and it will ask for a machine name. The tricky thing is it needs a 3 step ENTER + Ctrl+Z + ENTER to exit the input mode. (that's the best I could do for a quick solution)

I made it so you can also call it with a parameter, then it won't ask for a machine name. Example:
C:\>GetLastUser.bat SERVER12

Read other 8 answers


I am getting a error when I schedule a task on a remote machine. The remote machine is Windows server 2003. Here is the code that scheduled the task. Thanks to OutCaste for the code.

Set _hour=%time:~,2%
Set _minH=%time:~3,1%
Set /A _minl=%time:~4,1%+5
If %_minl% GTR 9 Set /A _minl=_minl-10& Set /a _minh=_minh+1
If %_minh% GTR 5 Set _MinH=0& Set /a _hour=_hour+1
If %_hour% GTR 23 Set _hour=0

schtasks /create /S [URL="file://\\"]\\[/URL] /u Domain\Username /p Password /RU "System" /ST %_hour%:%_minh%%_minl%:00 /SC ONCE /TN Test1 /TR "\"\\server01\scripts\Telnet.exe\"

In the log I get see this error

"test1.job" (Telnet.exe) 2/19/2010 11:52:59 AM ** ERROR **
The attempt to retrieve account information for the specified task failed; therefore, the task did not run. Either an error occurred, or no account information existed for the task.
The specific error is:
0x8004130f: No account information could be found in the Task Scheduler security database for the task indicated.


A:Batch file scheduled task error on remote PC

Read other 6 answers

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

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:


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

I haI have been accessing one of my windows 7 remotely using RDC. For some reasons  I can’t access it any more with this message:  
"Remote Desktop cannot verify the identity of the remote computer because there is a time or date difference
between your computer and the remote computer. Make sure your computer's clock is set to the corr... Read more

A:Remote Desktop cannot verify the identity of the remote computer because there is a time or date difference between your computer and the remote computer

Ours was a DNS issue.  Someone put an entry in the wrong firewall.

Read other 15 answers

Can anyone tell me how to create a batch file for shutting my computer down instantly or say maybe in 1 hour using notepad.

Just thought i would be a geek for the day and try new stuff out!!!!

Thanks in advance guys

A:creating a batch file to shutdown computer

roylee77 said:

Can anyone tell me how to create a batch file for shutting my computer down instantly or say maybe in 1 hour using notepad.
Just thought i would be a geek for the day and try new stuff out!!!!
Thanks in advance guys
LeeClick to expand...

Hi Lee,

What I did was to lookup the shutdown command using the Help & Support window from Start button. Then I made a clone of the shutdown icon and substituted the shutdown command with parameters to shutdown the computer by just clicking on the cloned shutdown icon from my Desktop.

You can use the parameters of the shutdown command to indicate 1 hour from Now to perform the shutdown (in seconds, I think), so, that would make it 3600. I think the parameter is -T or -t (I forget) - I'm using Linux now - too frustrated with paying all of the security license fees for av, spyware, etc. for Windows.

-- Tom

Read other 1 answers

I'm looking for a way to have a batch file run when a network computer is detected.

My laptop is often times inaccessible to my desktop unless I ping it first.
So I've created a batch file to ping the laptop but now I need to find a way to have it run when the laptop is detected on my local network.

Is there a way to do this through a windows event or any way at all?

Any help would be greatly appreciated.

A:Run batch file when network computer is detected

There are applications that can scan a network for a MAC address, but I don't know if any of them support trigger actions when one is found.

I would instead concentrate on fixing the inaccessibility issue. It sounds like the adapter is turning off when the laptop sleeps or after a period of inactivity. That's pretty easy to fix - check your power settings on the NIC and deselect the power saving option.

Read other 2 answers

Hey everyone,

Is it possible to run a program that is on another pc over a network? I am trying to create a small batch script that I can run to change a setting on a networked pc. It works fine on my pc, but I keep getting a "This is not a valid Win32 application" followed by "access denied" when running it from a different computer...

Is there a way? If not, is there another method of changing the system timezone without running rundll32.exe (Which is where my problem is at following this line to change it)...

pushd //the_pc_name's_c_drive/

// error here from rundll32
RunDLL32 shell32.dll,Control_RunDLL TIMEDATE.cpl,,/Z %a%
Thanks for any help

A:Solved: Run program from a different computer (Batch file Q)

Read other 16 answers

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
[COLOR=red]for /f "tokens=1 delims=[" %%G in ("PHASEID" %path%\%myfile%) DO ([/COLOR]
[COLOR=red]set PhaseID=%%G[/COLOR]
[COLOR=red]echo Phase: %PhaseID%[/COLOR]

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....



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

I have a laptop that I use as a sort of 'network server', though its really not. I have a Local Area Connection completely set up along with file and printer sharing, and I play a client game on my desktop that is linked to a software server that is hosted on the laptop. The laptop is jacked right into the router, and so is my desktop. I have to periodically update files on the laptop from my desktop to keep the game running nicely, and I have to re-start the software server manually at the laptop using a batch file I can view and edit on my desktop.

So, if I can view and edit said batch file, then why can't I make the laptop run the batch from my desktop? (It's a fair walk from desktop to laptop.) If you guys can make this work, that would be great. I don't know for sure, but you might need the ip addresses for both computers(found using cmd > ipconfig):

Desktop's IP:
Laptop's IP:

Thanks for reading, and I hope someone can help! I hope that wasn't too complicated to explain.
TSG SysInfo output:

Tech Support Guy System Info Utility version
OS Version: Microsoft Windows XP Home Edition, Service Pack 3, 32 bit
Processor: Intel(R) Celeron(R) CPU 2.53GHz, x86 Family 15 Model 4 Stepping 1
Processor Count: 1
RAM: 1014 Mb
Graphics Card: Intel(R) 82865G Graphics Controller, 96 Mb
Hard Drives: C: Total - 73171 MB, Free - 24372 MB;
Motherboard: Dell Computer Corp., 0CF458
Antivirus: AVG Anti-Virus Free... Read more

A:How do you make another computer run a batch file from your computer?

Read other 12 answers

Under Windows 7, is it possible to determine if a specific computer is logged in to a network? If so, how?

Thank you.

A:Determine if a network computer is online from a batch file

You mean if some other computer is connected and turned on?

If so, the easiest way is to simply ping it, if it replies it's online. If it fails, it's either powered off, or firewalled (by default Windows allows pings from anyone).
You can also use that in bat files, and use the returned errorlevel value for further actions.

Read other 2 answers

Under Windows 7, is it possible to determine if a specific computer is logged in to a network? If so, how?

Thank you.

Read other answers

I found this snippet of code while searching for things to help me solve the initial problem. It works like I thought it would but I don't understand what the || in the middle of the ping statement does.

Will someone give me a boost here?

Thank you.

Another variation without using any variable
ping racer -n 1 -w 100>nul || goto ingerror ... ingerror echo Host down goto eof :eof exit /b

Read other answers

Hey guys, i'm new to this forum, obviously since this is only my first post. I don't know where to actually post this so if a forum mod would like to move this feel free.

But i'm looking for a way to crash a Windows 7 computer, using a batch file. I know a decent amount about DOS/Batch files, but i don't know exactly how to crash a windows 7 computer using a batch file, because there was only one way i really wanted to do it, but with Windows 7 security fail safe, i can't take control and delete my "c:\windows\system32" folder.

You're probably asking me why i would like to do this, and the reason is because it's a school project. My instructor would like us to crash one of this lab computers using a batch file, which all i can do is Right-click>Run As Administrator. He wants it done with a lot of stylish stuff, and etc. But i'm not here for that, all i'm curious about is some different, unique, cool ways to crash a Windows 7 computer.
Batch file will be copied to the desktop and run as administrator.(No files other than the batch file may be copied to desktop)
Additional files can be utilized either as a result of creation through the batch file, as a result of downloading from the Internet or files native to the lab workstations.
Additional files are only to be utilized through the batch file
Speakers are available on-demand
Damage must be contained within the local machine

Is everything i'm allowed to do, plus i can use hardware damage.
Feel free t... Read more

A:[Help] Crash Windows 7 Computer, Batch File [Wrong Section?]

Personally I don't think such things should be posted. We are here to help fix computers not dream up ways to destroy them.

Read other 4 answers


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


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

Hi. First, thanks for any help you can provide.

I know that RDP can be started from the command line with the mstsc command, and that you can use .rdp files to store the information for the connection.

What I'd like to be able to do is to create a batch file that will prompt for a username and password, and pass that information into the computer it is connecting to. I've got 20+ users that all need to connect to the same group of machines throughout the day, and I can't store their passwords or create .rdp files for each person due to security restrictions.

I'm hoping to write one batch file that will get the users name and password, then connect them to each of the computers using that login information. I haven't been able to find any switches that allow me to pass in a user name and password, nor do I see any method of using a variable in RDP files.

Anyone know if this is possible, and how?

Thanks for any information you can provide!

Read other answers

Guys, I am having a real hard time doing a basic REMOTE REGISTRY QUERY using REG.EXE under WindowsXP.
Using reg.exe from (04/20/1998), I know there is a new version (08/04/2004) but I can't seem to get it to work either so I kept using the old one (worked for me in the past).

I need to query the following registry value remotely: HKCU\Software\OP\LP\Update\Synch
(Key=HKCU\Software\OP\LP\Update\, Value=Synch)
For example:
Remote Machine IP =
Remote Machine Account = RB
Using a tool (psgetsid.exe) I can determine that the RB account's SID on is: S-1-5-21-757019372-1432366915-1905203885-1000

set Station1=HKU\%%c\Software // this will set %Station1%=HKU\S-1-5-21-757019372-1432366915-1905203885-1000\Software

reg query %Station1%\OP\LP\Update\Synch \\
reg query \\\%Station1%\OP\LP\Update\Synch

The OUTPUT of my batch file is as follows:

Connecting to remote machine \\

Listing of [S-1-5-21-757019372-1432366915-1905203885-1000\Software]


The specified path is invalid.
As you can see neither approach generated the correct result - all I want to know is the DATA associated with the VALUE "Synch" in the HKCU\Software\OP\LP\Update\Synch
Approach #1 at least gave me a list of the Keys (as you can see OP is there) but this i... Read more

A:REMOTE Reg Query [reg.exe] in batch (.bat) WindowsXP

What you're doing (for the new version) looks fine. I just checked and that is the correct syntax:
reg query \\host\key /v value

However, when I set the value to something I know is *not* present, I get the same error message:
"Error: The system was unable to find th especified registry key or value"

I think somehow you've managed to add a spurious space into %Station% - the error messages seem to indicate this, particularly since it worked correctly, just didn't return the right value, when you enclosed it in quotes.

Read other 1 answers

Basically, I have a batch that will pull the current network drive mappings from the registry for a given SID and save it to a specified username's desktop.

This requires access to the machine (as if locally, so NetMeeting, RDC, etc.) and specifying the username and SID. What I'm trying to do is make it a remote batch, something that I can supply just the machine name and it automatically pull the current username/SID and fill in the blanks.

So, here's the code I have without remote access or automation:
@Echo off
set user=
set sid=
set /P user=Enter the username of the desktop the save to:
set /P sid=Enter the SID of the user:
reg export HKU\%sid%\Network "D:\Documents and Settings\%user%\Desktop\Network Drives.reg"
This works just fine from the local machine. Now I've tried modifying it to pull the current users information, but have only found two ways of doing so, %USERNAME% and "wmic computersystem get Username". The second one is great because it can be used remotely, which is what I'm ultimately hoping for.

Here's the issue with automating the username, the first the variable option returns the username of my administrator account and the command returns my administrator account + domain name (locally). Remotely, the username would only grab my account on my local machine while the command pulled the right information, but I can't use the domain name.

So, that's the first problem. Second it conve... Read more

Read other answers


I have shared a folder on my local network. I gave "full control" permissions to "everyone".
I can see and open files from remote computer, but I fail to delete them, as it gives "no permissions" error.

How can I fix that?


A:Can't delete a file on shared folder from remote computer

Something to try - Right click the file - properties - Security Tab - Advance -
Change Permission - put a check mark in the box for - Include inheritable permissions from this Object's Parent - Click - APPLY - OK - OK - OK

Read other 2 answers

Hi all,

Any idea how to write Batch File .bat to copy file from File Sharing & FTP Hosting to local directory.

Current the File Sharing & FTP Hosting is SMARTFILE.

I don't want to use WINSCP as the connector.


A:Batch File .bat to copy file from File Sharing & FTP Hosting

Hi Chacha,

Give this batch file a try. All text in red, you should adjust before running.

@echo off
echo.lcd C:\Some\local\directory
echo.cd /Some/server/path
echo.get Some_file_to_download.txt
) > "%TEMP%\_%~n0.ftp"
ftp -s:"%TEMP%\_%~n0.ftp" ""
del "%TEMP%\_%~n0.ftp"

Read other 1 answers

Hi all,
I need help to create windows batch file for following requirements.
1. Remove .txt and .log file format in sub folders.
2. Zip individual file inside any sub folders and give file name through command prompt. 
3. Create sub folder zip file include file zip

Read other answers

I'd like to run a batch file to check hard drive space on an XP computer, and if there is enough space available, then run some commands to create a directory to copy the files from remote server.

Read a text file with all the server ips
Run as service account
Verify that there is enough space on C:
Create a Install directory on remote server
Then copy the file from my computer remote server.

Can anybody please help me!!!

A:batch file to check hard drive space on an XP computer, and if there is enough space

I found this code on "SpiceWorks.com'.

I have not tested. I have not test (just to be clear). It's set up to determine % of free space (on a text file listing of servers) but could be modified to do what you want.

Read other 1 answers

Hello All.

I am trying to create a batch file that calls other batch files (device simulators).

The problem I am having is the batch file will not continue until the the call terminates, is there a way to continue it after the call (the batch only terminates after the user exits the simulator).

Thanks avamore

A:batch file: batch within batch

Welcome to TSG!

Use Start. The first set of quotes is for a title. It's needed in case the file name/command needs to be quoted, as in the 2nd example.

Start "" batch.cmd

This will open in a 2nd window. If the batch file you call doesn't use the Exit command that window may remain.
In that case use this instead:
Start "" "cmd /c batch.cmd"

Read other 1 answers

Dear All,

I need to create a batch file which can read the size of file(e.g. 1kb, 2kb...etc) from specific folder and detect 0kb file and convert it to text file (showing 0kb file size) with alarm.

I am not really sure how to write command for this batch file. Please help :-(

A:How to create a batch file to read size of file on specific folder path

Read other 10 answers

I've been searching the web on how to accomplish this but am coming up empty handed so I am hoping someone here can help...

I want my batch file to read a random line from a text file into an environment variable - can this be done?

I am using Windows 2000.

A:Batch File -- Read Random Line from External File into an Environment Variable

Read other 6 answers

I am trying to write a batch program the list the current directory files that end in *.dwg
into a file on my C drive.
I have used the following code:
dir *.dwg /b >C:FileListing.txt
start notepad C:FileListing.txt

This code only gives file names in the current directory.
I need to have a list of path and file names in the file FileListing.txt
Is there a way to do that without including subdirectories??

Thank you,

A:Solved: Batch file to list file names in current Folder.

Read other 9 answers

I created this batch file to log certain users logins. It creates a text file to log in, but doesn't populate any of the data to it. Could someone please take a look at it and see what I did wrong. I'm new to writing batch files.

Thanks in advance. Here is the code.

@echo off
set target=JDoe
if %username% == target echo %username% %date% %time% %computername% >> c:\logfile.txt

A:Solved: Batch file creates text file but does not populate data to it

target is a variable. You have to surrournd it with %% like any other variable.

C:\>set target=Squashman

C:\>if %username% == %target% echo %username% %date% %time% %computername% >> c:

C:\>type logfile.txt
Squashman Fri 05/23/2008 10:34:14.74 BUMBLE-BEE



Read other 3 answers

How to create a batch file that will move files based on the file type?

My Requirement : I need a batch file to copy all .doc files in all my HardDisk to a removable disk say (Z: drive) . Can anyone make it possible using a batch file?Please...Its urgent...

A:How to create a batch file that will move files based on the file type

Download XXCopy
XXCOPY, A Versatile File Management Utility --- Boldly Extended Xcopy
This is a vastly improved and extended version of DOS XCopy
Sorry, can't remember the syntax, but its quite simple if you read the manuel carefully :-)
Put the command line in a .bat file and it will run

Read other 4 answers

I am wondering if anyone can provide the equivalent to this linux script. When run against a text file with one entry per line being the name of a directory, it deletes the named directories.

On linux, I run this against the text list.
while IFS='' read -r line || [[ -n "$line" ]]; do
rm -R $line
done < "$1"

I am not sure how to make it do the same for Windows. I can do this, but I'm hoping there's a way to delete based on what's in the text file. Also, wouldn't want it to prompt for deletion of each, but to just delete.

@echo on
cd \
dir /D /N 0
for /D %%f in (XX*) do rmdir %%f /s
%comspec% /k

Thank you

Read other answers

I'm working on a batch file that will download a file I maintain, look for a string of text, and if it doesn't find the string, rename a file or folder, or change the file or folder's attributes to read-only.

I think I can handle the last part, and I already have the ftp part done, but I am having a hard time finding any good resource for the text string lookup/IF statement.

Any help is greatly appreciated. I'm new here, please excuse my ignorance if I am posting in the wrong area or violating any rules.


A:Batch file to compare text and rename file or driectory on fail

Read other 6 answers

Hi there forum,

how do you change the Visual effects using a batch file or registry file.



A:How to change visual effects using batch file or registry file?

Hello Edward, and welcome to Ten Forums.

The links in the blue note box under OPTION FOUR in the tutorial below may be able to help with this.

Visual Effects Settings - Change in Windows 10

Read other answers

Hi there forum,

how do you change the Visual effects using a batch file or registry file.



Read other answers

I have a computer that is a drone specifically for an outside LED sign. This computer is designed to never shut off and doesn't have any other program on it besides Operating System and the sign software. I need to create a batch file that I can place in the "start-up" folder that will open the program (LEDStudio10) and open the file that I want to play. I have already tried multiple attempts and I was hoping someone out there in sevenforums world would be able to point me in the right direction.

A:batch file open file for program in the startup folder

Task Scheduler. Create a new/basic task. You can invoke your batch script there. This can occur after boot completes, after user logon, etc. You can set it to run daily weekly hourly, etc. You can even have it delay X (preseleted time amounts) minutes/hours after boot/logon if you want.

Task Scheduler - Create New Task

Read other 1 answers

Hi Guys,

I want to make one batch file which daily copies yesterday's files from one folder & paste it to another folder.

C:/111 folder has following files.
1.zip had yesterday's date
2.zip had yesterday's date
3.zip had last sunday's date

now, when i will run batch file today, it only copies 1.zip & 2.zip & move to another folder C:/222

So C:/222 contains following
1.zip had yesterday's date
2.zip had yesterday's date

Please note , i have to run this batch file daily which should not require any changes.

Read other answers

I want a batch to select and open a random link file in a folder i have. All the links are music videos I like to listen to, and I kind of want to just have an option for 'surprise me!'.
I can change the file names if I have to, and I have a basic batch file ability. I know the simple commands, but nothing of the variables, signs-involving commands (&%!?), etc.

Also, I want to learn a whole lot more about programming/java/batch file, so it'd be awesome if any code could be explained. Thank you, in advance

A:I need a batch file to open a random file within a certain folder/path

There's a free Windows scripting language called Autoit3 that would do this task easily using these functons:


AutoIt - AutoItScript
It has a Basic like syntax and is easy to learn.

Another popular scripting for Windows is AutoHotkey
AutoHotkey: macro and automation Windows scripting language

The syntax can be confusing but it has object support and is more powerful.

Of course there are tons of others for Windows:

Here's a list. The details for each tell which OS are supported:
Free Programming Languages - Freebyte's Guide to

Read other 5 answers


I have a file in a folder on a network drive whose path is : "\\sql\imp\ssis"

I need a windows batch file that looks into the above folder for a file with a name like : "abcd_03052012_84373.txt" .

The above file name has a date embedded in it in "ddmmyyyy" format. I want that to be extracted and put into a variable or a file somewhere so that I can read that later and store into a sql table.

Please help.

A:Solved: Extract Date from File Name - Using Windows Batch File

Read other 6 answers

More as an alternative to twiddling my thumbs than anything else, I tried to produce a batch file that would count up the number and size of files in a folder, as well as the number and size of files with each extension. Hence it would say how many word documents I have and how much space they're taking up, etc.

I've managed to get a vaguely working model, but the output formatting is terrible (I just wanted it to say X bytes in Y "Z" Files, none of that ugly dotted variable names) and I have failed to get it to equate .htm and .html, .jpg and .jpeg, etc.

IF EXIST FTypeDst.txt ERASE FTypeDst.txt
ECHO. >FTypeDst.txt
ATTRIB +A FTypeDst.txt

ECHO Please Wait Paitently. . .


REM cycle through the current directory and subs, Increment Allnumber, Allsize, define and increment Number of * files, size of * files.
FOR /R %%F in (*) DO (
IF NOT DEFINED Number.of.%%~XF.files (SET /A Number.of.%%~XF.files = 0)
IF NOT DEFINED Size.of.%%~XF.files (SET /A Size.of.%%~X... Read more

A:Solved: File Type Distribution analysis: Batch File.

Posted via Mobile Device
You would be better off using third party software that already does this. Plenty of them out there.
I personally would check the extension of each file using the cmd extensions of a for loop. then do an if statement for each file type you want to keep track of. then use a call statement to branch to a function that adds up the file sizes and number of files.

Read other 3 answers

If anyone can help it will be greatly appreciated,I am taking A + Essentials and my instructor isn't explaining it,

A:How to switch file type name to contents using a batch file for notepad

If you are as it appears you are paying for a Course for a Comptia A+ certification and the teacher isn't doing the job why haven't you gone to the school and asked them to switch you to a course with a different instructor? Or Demand a refund?

When I got my A+ back in 2000 it wasn't that hard to pass. I believe it was two tests and I was over 95% on both with no training course. I was experienced in computers and doing things and They did have a sample test as I recall it.

And of course that old standby Google

I'm afraid I can't help you further as the tests have changed a lot over the years.

Read other 1 answers

Hi all,

Please help!! I'm having a problem to copy some files from a folder.
My folder have lots of files and is there any way for me to write a batch file to copy only files according to "date modified"? For example last week files or yesterday files.

Please help!! Urgent!!!
Thank you.

A:Urgent!! Copy file by date modified using Batch File.

Take a look at XXCOPY: http://www.xxcopy.com/index.htm

Read other 2 answers

Hi . I'm making a "PC TuneUp" project , but something is wrong . When the batch file tries to check for updates , it closes . Fortunately , i know that it closes because it doesn't find the file . But i tried everything - nothing worked . Please help !

@echo off
for /F "tokens=1" %%G in ('tasklist /V /NH /FO TABLE /FI "WINDOWTITLE eq TehDansorz"') do IF %%G==cmd.exe exit /b
if exist newest%winver%pctuneup.ver del newest%winver%pctuneup.ver
if exist %winver%pctuneup.ver del %winver%pctuneup.ver
set winver=Win7+WinVista
set ver=1.6a
set title=title TehDansorz's PC TuneUp for Win7/WinVista Version %ver%
title Requesting admin permissions ...

:: BatchGotAdmin
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Administrator privileges are required for this app to work .
echo Please click OK in the following screen .
PING -n 1 -w 600 >NUL
goto UACPrompt
) else ( goto gotAdmin )

echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

exit /B

title Got a... Read more

A:Solved: Batch file closes when downloading version file

Read other 7 answers