-2

I work for ABC company and we use logmein extensively. I like to create some scripts but the word script and the .files that are associated are so general that it is difficult to find a starting point.

I dont understand lots of aspect of scripting and I have google, read forums about it but everywhere I go they seem to be talking about something else related to it. My questions are as followed...

1. .cmd,cmd.exe,batch file, .ps and exe are all examples of different versions of scripts? That are written using note pad or some other program similar to it and not a developer environment.

2. what is the difference between a .cmd, cmd.exe, batch file and .ps? my understanding is that batch files can call .ps, .cmd and cmd.exe but in .ps cmdlets exists. I am still very confused on the difference and do i build scripts that use these file extensions in one big file with in powershell?

3. Could I script in c# to automate windows os and have them call powershell that calls batch file or .cmd, if so would that make the file extension a .exe or what?

  1. where is a good place to start building scripts that involve programming languages, powershell, batch files or more like a lab exercise. I plan on trying to run them on remote end users. Later I tend to run them on server 2012, AD, SQL(can my c# script call SQL and query at the same time).

Any information or pointed in the right direction would be greatly appreciated.

Jace Browning
  • 11,699
  • 10
  • 66
  • 90

1 Answers1

3
  1. Scripts are normally text files with instructions in a particular scripting language (e.g. batch, VBScript, Perl, Python, PowerShell, Ruby, JavaScript, …) that are processed by a script interpreter for execution. See here for an explanation of the difference between interpreted and compiled languages.

  2. .cmd is an extension used for batch files in Windows NT based operating systems.

    cmd.exe is the interpreter for these files (it's also an interactive shell).

    batch file is a term for referring to files written in the batch scripting language.

    .ps is an extension for PostScript files. I assume you actually mean .ps1 here, which is the extension for PowerShell scripts.

  3. C# is a compiled language, so normally it can't be scripted. You can run C# code in PowerShell scripts, though.

A good place to start with scripting would be a tutorial for your chosen language.

Community
  • 1
  • 1
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328