Questions tagged [batch-file]

batch files are simple text files executed in a command to achieve a particular task or a set of tasks

batch files are text files containing commands executed in sequence to achieve a particular task or a set of tasks. They can be very simple, or can contain complex logic.

440 questions
5
votes
3 answers

how to get default gateway of certain adapter in windows bat?

Please see below ipconfig output in windows. C:>ipconfig Windows IP Configuration Ethernet adapter Local Area Connection 11: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::4149:4c25:692d:dfec%91 IPv4…
5
votes
3 answers

How to compress files in Windows in batch file?

I can compress files or folders in Windows from GUI by right clicking and selecting "Send to .. Compressed (zip) file..". Is it possible to do same in batch file?
Harriv
  • 173
  • 1
  • 3
  • 7
5
votes
9 answers

What scripting language do you use for your logon scripts in your Windows enviroment?

I wonder what scripting languages is most used as logon scripts these days. Is people still hacking away in batch-file files or vbscripts, or do you use PowerShell or something completely different? Personally, I have pretty good experience with…
Egil Hansen
  • 203
  • 2
  • 8
5
votes
1 answer

How to revert the compressed attribute on files in Windows for a whole drive

Someone at my job (a sysadmin) actually performed a "cleanup" task on WinXP which at the same time compressed all the files on my HDD with the Windows compressed file attribute (Filenames get blue in Windows Explorer) I don't actually need my files…
MaxiWheat
  • 237
  • 5
  • 12
5
votes
3 answers

Windows Server 2008 - Calling FTP from .CMD - Pass a parameter to an FTP file?

I am calling the following from a .cmd file: ftp -d -s:D:\backup\web-daily.txt The web-daily.txt file is an ftp input file with similar contents to this: open put d:\backup\web-daily.7z web-daily.7z quit I need to be…
5
votes
10 answers

finding user's documents folder in .bat script

What is the best way to find a user's Documents folder on XP and Vista from a batch script? Is it safe to assume that it's %USERPROFILE%\Documents?
lajos
  • 1,345
  • 4
  • 14
  • 8
4
votes
2 answers

Copy single file using robocopy

I'm writing on a batch file to copy a certain file to a samba-share. I've already read robocopy transfer file and not folder and thought I would be good using robocopy "E:\Some\Path\with spaces" "\\sambaServer\some\path\with spaces" "myFile.rar" /z…
derHugo
  • 143
  • 1
  • 1
  • 7
4
votes
1 answer

Script for renaming files and adding a timestamp (server 2012 r2)

I'm struggling to create a (fairly simple) batch file script that meets these requirements: Looks in the folder called Source for a file (with any name.csv) Renames the file to File_YYYYMMDD_HHMinMinSS.csv (timestamp should be modified/creation…
SysAdminUK
  • 113
  • 1
  • 2
  • 14
4
votes
2 answers

Is there a way to change passwords on multiple servers simultaneously?

x3 Server 2012 R2, x2 Server 2012 My system has 5 servers; 1 Hyper-V server hosting 2 vm servers (these are the x3 2012 R2 servers), and a Win 8.1 pc running hyper-V that hosts 2 more vm servers (these vm's are the x2 2012 servers). Every 45 days…
4
votes
1 answer

How to get login username of the login that triggerred a task in the task scheduler

In the Windows 7 task scheduler, I have a task that runs when any user logs on. This task is run as Administrator so it can get the proper priviliges and runs a bat file. I would like to pass in the username (userid) of the user that logged in,…
ciso
  • 217
  • 3
  • 14
4
votes
3 answers

How do you remap a share to a different drive?

I want to write a start up script to take an mapped drive, change the drive letter, then put a different share on the original drive. How can this be done?
Bob
  • 2,937
  • 5
  • 29
  • 32
4
votes
7 answers

How to create a yesterday date in a batch

copy \\server01\E$\LogFiles\IVR\bcR\??120428.* \\LBC\workgroup\cs\ftp\Team\bcR\ copy \\server02\E$\LogFiles\IVR\bcR\??120428.* \\LBC\workgroup\cs\ftp\Team\bcR\ copy \\server03\E$\LogFiles\IVR\bcR\??120428.* \\LBC\workgroup\cs\ftp\Team\bcR\ copy…
Joe
  • 41
  • 1
  • 1
  • 2
4
votes
3 answers

keep command window open after running bat file

i have a bat file that has the following it: sm start "Schedule" this code runs but the command window closes immediately what can i put inside the bat file to keep the window open?
Alex Gordon
  • 455
  • 3
  • 14
  • 31
4
votes
2 answers

How to send the current working directory as an argument in windows?

I want to send a path as an argument to an executable. what I want to do something like this: pushd some\folder set x=cd popd MyExe.exe %x% the problem is that the x variable is now equal to the string "cd" but what I want is to get the output of…
Ohad Horesh
  • 249
  • 2
  • 4
  • 7
4
votes
4 answers

How a batch file runs on a remote machine started by PSEXEC

I am having an issue running a Batch file on a remote machine suing PSEXEC. The file runs but does not run like it does when run through remote desktop. The batch runs a file which is a 32 bit application, which opens multiple 16bit applications,…
RisingCascade
  • 41
  • 1
  • 4