A battery-operated work machine comprising: a main body ; a front work implement attached to the main body ; a battery ; an electric motor driven by electric power of the battery ; an inverter that controls the electric motor ; a target revolution speed instruction device that gives an instruction on a target revolution speed of the electric motor ; a hydraulic pump driven by the electric motor ; an actuator to which delivery fluid of the hydraulic pump is supplied to drive the front work implement ; a traveling motor that is a variable displacement type hydraulic motor to which delivery fluid of the hydraulic pump is supplied to cause the main body to travel; a traveling mode instruction device that gives an instruction on a traveling mode of the main body ; and a controller that is configured to control the inverter such that a revolution speed of the electric motor coincides with the target revolution speed, characterized in that the controller is configured to switch the traveling motor to a travel first speed side with which a displacement volume is a large volume in a case where an instruction on the travel first speed is given by the traveling mode instruction device , switch the traveling motor to a travel second speed side with which the displacement volume is a small volume in a case where an instruction on the travel second speed is given by the traveling mode instruction device , and control the inverter such that the revolution speed of the electric motor is kept at the target revolution speed and switches the traveling motor to the travel first speed side, irrespective of an input from the traveling mode instruction device , in a case where the remaining capacity of the battery becomes lower than a first threshold value set in advance. a main body ; a front work implement attached to the main body ; a battery ; an electric motor driven by electric power of the battery ; an inverter that controls the electric motor ; a target revolution speed instruction device that gives an instruction on a target revolution speed of the electric motor ; a hydraulic pump driven by the electric motor ; an actuator to which delivery fluid of the hydraulic pump is supplied to drive the front work implement ; a traveling motor that is a variable displacement type hydraulic motor to which delivery fluid of the hydraulic pump is supplied to cause the main body to travel; a traveling mode instruction device that gives an instruction on a traveling mode of the main body ; and a controller that is configured to control the inverter such that a revolution speed of the electric motor coincides with the target revolution speed, characterized in that the controller is configured to switch the traveling motor to a travel first speed side with which a displacement volume is a large volume in a case where an instruction on the travel first speed is given by the traveling mode instruction device , switch the traveling motor to a travel second speed side with which the displacement volume is a small volume in a case where an instruction on the travel second speed is given by the traveling mode instruction device , and control the inverter such that the revolution speed of the electric motor is kept at the target revolution speed and switches the traveling motor to the travel first speed side, irrespective of an input from the traveling mode instruction device , in a case where the remaining capacity of the battery becomes lower than a first threshold value set in advance. <EOS>