Questions tagged [batch]

A batch file is the name given to a type of script file, a text file containing a series of commands to be executed by the command interpreter under MS-DOS and Microsoft Windows.

Filter by
Sorted by
Tagged with
0
votes
1answer
22 views

Windows Batch: Command FOR /F and Tokens, How can I ser variable from token X until end of the line?

Ok, I been struggling with this for days now. I have a little complex script but at the end I just need to set a variable from a Token 4 to the end of the line. Basically I run a command and the ...
0
votes
0answers
35 views

How to create a Shutdown Script for Server 2016

I have a Windows 2016 server running an Oracle database that needs to be manually shutdown before the server shuts down. I enabled the local GPO (Computer Configuration > Windows Settings > ...
2
votes
1answer
40 views

Getting full windows version on Batch or Powershell. (Like “Microsoft Windows [Version 10.0.18363.900]” On Windows Server 2016

I have this issue. Using just command "ver" in batch I get: Microsoft Windows [Version 10.0.18363.900] I need the last sub-build version (900) for an script to determine if windows is on ...
0
votes
1answer
35 views

How to secure the SQL credentials in a batch file (PowerShell inside) to run a script using sqlcmd

My goal is to create a batch file which performs a SQL (express) DB backup every time it's executed. But I don't want to store a clear password in that batch. Using PowerShell, I successfully created ...
0
votes
0answers
15 views

multiple robocopy calls in one .bat file won't run

I'm trying to backup some files from my Windows server to an external USB drive using robocopy. Running robocopy tasks in cmd works fine but in the .bat it won't run and instead just echoes the ...
0
votes
1answer
87 views

Read Local “HKEY_CURRENT_USER” from another user, windows batch/powershell

Ok is a tricky question, I know. I have a software that runs validation scripts in all computers in network. I can create my own scripts too. But I found a problem that the script runs as specific ...
3
votes
1answer
993 views

Microsoft Intune - How to modify Windows 10 registry settings?

Win32 app uses bat file to install software and edit registry keys. Registry keys are modified if I run bat file locally but not when run through via Intune because Intune runs installation as System. ...
3
votes
3answers
68 views

How to get all processes under a session of a particular process that is using a port in Windows cmd

I want to list and kill all processes belonging to a session of a particular process that is using a port. This should happen through a windows batch command that would accept a port number as input. ...
2
votes
2answers
454 views

Windows Batch - Get name of currently logged-in user

In a sort of small mitigation for a large network for the exploit of replacing utilman.exe on windows repair, by cmd.exe, then changing user password, I'm doing a small script based on EventSentry ...
0
votes
1answer
74 views

RDP into a machine with out a user password

The computers dont have passwords, even the admin account ass they are training units. But we cant RDP into them with out passwords. I know the settings are at Windows Settings\Security Settings\...
0
votes
0answers
50 views

Set proxy.pac by script

In my company we are using a proxy that is set via a proxy.pac. Additionally to make life easier I am using a socks proxy via ssh to reach a special network area that is usually only available via a ...
0
votes
0answers
109 views

Windows Search Indexing Locations: GPOs don't apply when setting via registry

If I enable of the following templates via gpedit.msc, they apply correctly: Computer Configuration\Administrative Templates\Windows Components\Search Default excluded paths Default indexed paths ...
0
votes
1answer
111 views

Get the previous day date as variable in batch file from powershell command output

The scenario is like this. I need a previous day date (i.e. Today -1) as variable in a batch file. But if previous day is Sunday (i.e. script running on Monday) it should return the Saturday's date (i....
1
vote
2answers
195 views

Can't remote reboot domain PC

I use bat + Powershell script to reboot a domain computer. I do not want to use domain admin but local user with admin privileges. bat file: PowerShell -NoProfile -ExecutionPolicy Unrestricted -...
1
vote
1answer
44 views

language-neutral recursive takeown

In .bat files for Windows's cmd.exe, recursively taking ownership of a folder's content goes takeown /f foldername /r /d Y >nul: 2>&1 Problem is, it works only if in the current locale the ...

15 30 50 per page
1
2 3 4 5
22