windows

Can a script.bat make changes to Windows PATH Environment Variable

I'm trying to write a script that when clicked will add a couple of entries to the PATH Environment variable in Windows, instead of making the changes manually. I see .bat files being used all the time on Windows for a variety of reasons, so can a .bat script help me with something like that? I actually need to download a zip from a lo...

Problem with mysqldump: "--defaults-extra-file" option is not working as expected

I run the following command from the Windows command line to backup my database: ...\right_path\mysqldump --add-drop-database --databases my_database_name --defaults-extra-file=d:\1.cnf where d:\1.cnf contains the following: [client] user="my_user" password="my_password" Unfortunately, I got the following e...

Is wget a default in Windows, if not what download function is available by default

I made many changes to my machine so not sure if wget is available as a result of my changes or it always exists by default on Windows machines. Does it come with Windows If not, what download function can I use in a Windows .bat script to download a file from the web. This function has to be available by default ...

bat function to edit a file (add line to start of a file)

In my bat script, what do I use to open a file called open.txt and add the following line to the top SOME TEXT TO BE ADDED Can small edits like this be handled in a .bat script ...

How .bat can check if curl or wget exist

In my .bat file, how can I check if wget or curl are available in the system through whatever other previous installations the user may have went through. Is this check possible, and can I have if then else logic in my file to react differently, like we do in normal programming. I basically want to use wget or curl to download a file. I...

bat adds line at specific line number

I'm taking this approach to add a line SOME TEXT TO BE ADDED to the top of an existing file. Is there a way to specify the exact line number to add the new text. For example, before the last line (and add a line break) or after the 3rd line (and add a line break) copy original.txt temp.txt echo.SOME TEXT TO BE ADDED>original.txt type te...

How do I set an Win32 system environment variable in Perl?

I want to be able to set a system environment variable in Perl and I wrote the following script (inspired from this idea) to accomplish this: use Win32; use Win32::API; use Win32::OLE qw( in ); my $machine = "."; my $WMIServices = Win32::OLE->GetObject ( "winmgmts:{impersonationLevel=impersonate,(security)}//$machine/root/cimv2" ) || d...

bat read a file line by line

In my bat script, is it possible to access a txt file and read it line by line. The idea I'm having is to check if the line starts with an identifier word (in my case 1 or 2 stars * or **) but to do this I need to read the file line by line. ...

Why call CoFreeUnusedLibraries() before OleUninitialize()?

While trying to resolve process hanging on CoUninitialize() I came upon a piece of code shared by many of our projects. When a program is going to quit it first calls CoFreeUnusedLibraries(), then immediately OleUninitialize(). While the effect of OleUninitialize() is quite clear I can't find why one would want to call CoFreeUnusedLibra...

Cygwin and alternatives to replicating linux commands on windows

I keep running into issues with a .bat script I want to write to automate some tasks related to the setup of my PHP application. I can't for instance do simple wget to download files and so on. I hear that by installing Cygwin, the user should be able to have access to all linux related commands, so my script will run without problems....

How do i make a C++ DLL call my overloaded global new operator?

I have overloaded global new/delete (and new[] / delete[]) to fill and check guarded blocks. Works fine. Now i link to C++ DLLs passing STL-Container instances that are filled or modified by the DLLs. When destructing these containers i run into an error, as they were not allocated using my overloaded new operator and vice versa the dlls...

Cannot start desktop application from Windows service on Windows 7

HI, I have C# WCF windows service on Windows 7 logged on as user with admin rights. I am trying to start desktop application after service start. All discussions I found are about windows stations and desktops... I created a separate thread, set thread station and desktop and tried to start desktop application. Code works when I start ...

Windows WCF client with internet proxy server showing error The server committed a protocol violation. Section=ResponseStatusLine

Our team trying to create a windows application(c#) to call a WCF service using internet proxy server Showing exception "The server committed a protocol violation. Section=ResponseStatusLine" while calling WCF service Please give suggestion to solve this problem/any other alternative solution //Code for creating proxy public static De...

The memory cound not be "read". - random crash

I have a problem with a random crash caused by CSceneNode* pRoot = nodes[0]; // The real problem is = nodes[0]; Crash message is: The instruction at "0x0059d383" referenced memory at "0x00000000". The memory cound not be "read". I do not see the problem, could please help me out ? In Save.cpp void CNESave::SaveLocation(CNELocation* p...

Need help with writing a batch file

I'm writing a batch file on Windows which gets one argument: a zip file name that was created with 7-zip. This file contains a single MySQL backup file inside, say backup.sql. I would like to restore the database given this zip file. So, first I extract it to a temporary directory like this: path_to_7zip\7z e "%~1" -otemp_dir And n...

How to insert the output of a command to variable in a batch file ?

Inside a batch file on Windows I would like some variable to have the output of dir /b command. How this can be achieved ? ...

Is there a tool to spy out messages sent to a window

Hello everybody! Is there a tool that shows messages sent to a specific window? I've heard that WinSpector should do it, but the site seems to be offline. Best regards, David ...

How to identify which line in the batch file has a syntax error ?

I'm running a batch file on Windows and got this error: The syntax of the command is incorrect. Is that possible to identify which line in the batch file is incorrect ? ...

vbscript inserting a line alphabetically

I'm trying to insert a string that begins with the word title as in title: New string to be inserted into a file that has the following format. A bunch of text at the top, a block of lines each beginning with the word title:, and a bunch of text at the bottom. Some content here at the top And more content and the titles will begin ne...

How to retrieve data from clipboard as System.String[]

When I copy data from my application, I wrote a simple C# script to check what type it is. Apparently (and I expected that), it's an array of strings: IDataObject data = Clipboard.GetDataObject(); Console.WriteLine(data.GetFormats(true)); // writes "System.String[]" Now when I extract the data like object o = dat...