Windows Batch

11K

Solutions

8

Articles & Videos

11K

Contributors

Batch files are text files containing a script of commands that are executed by the command interpreter on DOS, OS/2 and Windows systems. Most commonly, they are used to perform a series of functions that are repeated -- copying a set of files created daily with one step, for example.

Share tech news, updates, or what's on your mind.

Sign up to Post

i need a batch file to create this path: C:\Windows\winwin123
this path already exist: C:\Windows\  but the folder called  ''winwin123 '' must be created ,afetr is created i want to go there: C:\Windows\winwin123
0
Enroll in June's Course of the Month
LVL 8
Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Hi all,

I am currently in the process of putting a logon script together in order to map network drives for users. This should be easy, but the drive mappings will be connecting to storage on another domain - without any trust relationship between the domains.

There is a legitimate reason for the trust not being there, if it was this would be much easier.

Each user has their own logon script (%username%.bat), which has a list of drive mappings using the 'net use...' commands to map to the storage on the second domain. Within the second domain, they also have another AD account (exactly the same username format) with the correct permission to the storage.

My initial idea was to place a script called 'runas.bat' within the 'NETLOGON' area of the domain they're logging into, with a one-liner of runas /user:<secondDomain>\%username% "%username%.bat" - hoping that this would run for each user, ask for their credentials to the second domain, and then run the required %username%.bat for that user to map the drives.

The problem... the 'runas' script will not run against a UNC path, so the script also defaults to 'system32' and the %username%.bat scripts cannot be found.

I have seen suggestions of temporarily mapping a drive letter within the 'runas.bat' script, but this would get messy.

The domain they're currently logging into will soon go, they're in the process of migrating all users, business data, and applications across to the new domain. The data …
0
I have a lot of documents that I have not opened in several years.   I do not want to delete them, as I may need them in the future.   How can I find the oldest ones without having to open every folder and search for them by date modified?
0
I have a folder which contains several thousand .pdf files.
I would like a program which can
1. find a file in a folder based on the file name
2. copy that file
3. paste that file to another folder

All these "source" files will be in .pdf format in a single folder.
I need it to do this in a "batch" format where you can specify several file names in a given folder and copy all those specified files over to a different folder.
I have used Excel to generate a list of the file names that I want to copy/paste.

Thanks in advance for any insight on how to accomplish this!
0
The original filename is "test.txt".
The requirement is to append the date + Timestamp (format yyyymmdd_hhmmssmsi.txt) at the point the file "test.txt" is generated.


yyyy - year
mm - month
dd - day
ss - second
msi - milli-second
0
How to automatically stop the exe process when it can not run? i start exe process i check ALL ACTIVE PROCESSES and I do not see him anywhere,then how can I stop it immediately
0
I have a large number of batch files which launch another batch file "backuplog" in this manner:
[path]\backuplog.bat" textprogramname  %profile%

The receiving program backuplog.bat does this:

echo %1 %2 %date% %time% >%fileloc%\temp.txt

Now I want to add a leading parameter (so %1 %2 %3) and I want %1 to be a set of blank spaces so I can indent the entry appended to the temp.txt file.

Like this:
echo %1 %2 %3 %date% %time% >%fileloc%\temp.txt

And, I have another set of .bat files that would cause a different level of indentation with such spaces.

So, I envision the first .bat file to have something more like this:

path]\backuplog.bat "spaces" label %profile%
where "spaces" will vary depending on which preceding batch file is passing the parameters - so it will originate there and be passed as the first parameter (or *any* parameter that would work of course).
0
Hi Experts
I need a batch file to change folder permissions and sub folders to the following
remove every users permissions except the administrator and the administrator only have the read only option
0
My source folder is a build output folder where in multiple folders will get created. I would like to pick the latest folder to the destination folder using robocopy or any other method. how can I do it ?
0
Hi All,

Does anyone have script to Remove Sophos EndPoint 10.7 ?

I have tried the script under;

https://community.spiceworks.com/scripts/show/1601-sophos-9-5-10-removal-script?page=2 

Doesn't work for 10.7.

Thanks
0
Turn Insights Into Action
Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

Who can help me create a script to monitor and stop automatically MySpecific.exe process but only when CPU activity is idle for a given period of time?
e.g: I run MyTool.exe ok ? how can i monitor the CPU activity?and when MyTool.exe is idle for a given period of time (lets say 1-2 min) then the created script must stop  MyTool.exe process,is possible that?can anyone help me?
thank you!
0
Hi

I have a windows task scheduler job but needs to call another batch script to another scheduler task job called testbatchtrigger.bat

Any ideas ?

Thanks
0
I'd like to be able to run a weekly script on my domain workstations (Windows 7 and windows 10) that will populate a CSV log with username, computername and last successful windows update.

What I currently have is this:
--------------------------------------------------------------------------
SET filename="C:\Windows\System32\catroot2\dberr.txt"
FOR %%f IN (%filename%) DO SET filedatetime=%%~tf
echo %username%,%computername%,%filedatetime%>>....hotfixes.CSV
--------------------------------------------------------------------------

This kinda works, but doesn't tell me an update failed. Or if updates were downloaded but not installed.

Is there a better way to achieve what I'm looking for?
0
I have a dos batch file in windows 2012 however if i run the file as a normal user it displays 'access denied' but it works if i run it as an administrator, which i do not want to run it as administrator, it must run as a user

Any ideas ?
0
Hello All,

I have been trying to get some assistance and received various inputs in one of the earlier question to run a .bat file on multiple servers.
Below is the steps I want to execute:

a. We have 109 server (Windows 2012 Server)
b. There is a batch file in D drive with same name and location on all 109 servers
c. I want to run that particular batch file on all servers in one go
Usually when I login to my session using credentials and launch the batch file, multiple command prompt windows start loading. When I used PSexec script it works for individual machine but there too I had a challenge... If my PC gets locked the batch file fails and stops.

All I am looking here is to run that particular batch file on all servers and if I login to my session I should see it has started. I want the batch file to run under by login session. Please help as this is very critical to be completed ASAP.

Let me know if any more information required.
1
Hi

I would like a DOS batch script that checks the status of a running task, however if the task is running more than 10mins to complete, the task should stop running and report that the task has been running more than 10mins
0
Please help me with a command or script give a few folders read and write permissions on remote machines using ICACLS in windows 2k12 servers.
0
I need to write a script to have a PC dump certain log files.  I have to use DameWare to get to these PC's, so i am remoted in.  After the files are dumped into (preferably) a .zip file, i would be set.  However, the dates change daily, as does the number of files.  Some days here may be 3 logs, some there may be 9 (or more).  I need help writing this script, as well as t-shooting the firewall problem.


Thoughts ..........?
0
Greeting Experts,

I need a basic batch file where I can move list of records (from one directory to another) that are older than 10 min based on the last write time. I need to have this bat file kick off every 10 min once it starts... Is there somebody that can help me with this request...
0
Turn Insights into Action
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

I have a FTP transfer from a server to the client(server). It is using a bat file and a .scr file which runs the script. When I run it it goes to ftp command prompt and it stops there. It  was running well in a Sql server 2000. When upgraded to SQL server 2008 R2.
The script is as follows.  (IP Address, user and password have been obscured)

KAinsert. bat runs KAinsert.scr
Opens Command Prompt.

ftp> ftp
open XXX.XXX.XX.X
USER
PASSWORD
put kafada05
quit
0
Hello,

We are using a software to generate some results in a .csv format.
If a run the program using the .bat file from the Windows user, it keep the program configuration.

Issue
When whe run the .bat file with PHP exec function, the .csv file is generating but it don't keep the program configuration.
Maybe Wamp or PHP don't use the registry configuration of the program ?

Someone has any idea ?

All my best,
theBatFile.txt
run-php.JPG
0
Want to run a batch file which is under C:\Temp which is present on all windows vitrual servers.
I want a power-shell script or a batch file to complete this action...
I have over 120 servers.
Even if I need to create a text file with server names please guide me accordingly.
Any help appreciated.
0
As topic says - I'm looking for a way to disable a very specific usb port when I'm running the batch file, or any other method. It just has to be a file that enables / disables the usb port.
Also I'm using win7

thanks in advance!
0
I have one server Example it IP address is 192.168.1.1 and on my VB.Net application, how can i see the usage % of Memory that use on my server without remote to server to see? or is it possible to write some script in notepad and save as batch file to run and see?

Thanks in advance.
0
Dear friend i have situation where i need to automate some oracle application.My requirement is that i want to get the filename from the specified folder in windows operating system a and pass it as a parameter in the  batchfile .Same time i want to copy the file from that location to another location and delete the file once the execution of batch file is completed.
Thanks
Majid
0

Windows Batch

11K

Solutions

8

Articles & Videos

11K

Contributors

Batch files are text files containing a script of commands that are executed by the command interpreter on DOS, OS/2 and Windows systems. Most commonly, they are used to perform a series of functions that are repeated -- copying a set of files created daily with one step, for example.