Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Why is my batch script freezing? (windows 7)

12 Jan 2016   #1
bertstares

64
 
 
Why is my batch script freezing? (windows 7)

This is not the entire script but this the line that is freezing, i'm just trying to compile some basic information from the computers in my domain with this login script.

When running just this line as a bat file it will hang until closed and when you attempt to close CMD it lags up and displays a bunch of C^C^C^C^ before doing so.

for /f "tokens=3 delims=," %%a in ('"getmac /v /fo csv | findstr Ethernet"') do echo %%a


This command works perfectly when pasted into CMD prompt so why does it freeze when I make into in a .bat ?

also inserting exit at the end does not help, the script never gets past this command and just hangs there.


My System SpecsSystem Spec
.
13 Jan 2016   #2
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hello Bertstares,

Given the clues you've provided, it seems that the name of your batch file conflicts with that of an external command you are using in the problem command line you mention. I.e., you've managed to name your batch script either "getmac.bat" or "findstr.bat" (though I'm betting on the former).

There are two solutions here: either you rename your batch file (preferably to something more verbose, such as "GetMacAddress.bat") so that it does not conflict with any of the names of the external commands you use in your batch program, or, if you wish to keep the name of your batch file as is, just append ".exe" to the command that is causing the naming confliction.

E.g. If the name of your batch file is "getmac.bat" then append ".exe" to the Getmac command:
Code:
for /f "tokens=3 delims=," %%a in ('"getmac.exe /v /fo csv | findstr Ethernet"') do echo %%a
My System SpecsSystem Spec
13 Jan 2016   #3
bertstares

64
 
 

Wow, I feel so stupid right now. The name of my file was Getmac. Thank you so much, everything works now.
My System SpecsSystem Spec
.

Reply

 Why is my batch script freezing? (windows 7)




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Help Need in batch script
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...
General Discussion
W10 TP : Old Windows Update Batch/Script
Hi, I need you for obtain a batch for apply this custom : Retrouvez votre bon vieux Windows Update sous Windows 10 - Le comptoir du hardware Can you help me ? Thanks Have a good day !
Windows Updates & Activation
Windows 7 creating blank txt file after running a batch script
I have the following batch script @echo off setlocal enableextensions set "baseName=dnshistory" set "count=0" for /f "delims=%baseName%." %%a in (
General Discussion
batch script help
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...
General Discussion
Standard Windows batch script not working
I am trying to run a simple shutdown script..easy no big deal shutdown -r -t 00 And I created a desktop shortcut and assigned a hot key to it to speed up the process. Problem is I try to launch the batch script and instead I get a command prompt window that goes to the script directory, types...
General Discussion
Help me with Batch script!
Hi, Can somebody assist me with a .bat file I am trying to create? This is what I have now: 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-1ed39450e522The first 2 lines start...
Software


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 22:29.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App